@rxap/layout 19.2.6-dev.0 → 21.0.1-dev.0

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 (272) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/compodoc/changelog.html +33 -0
  3. package/compodoc/components/LayoutComponent.html +23 -31
  4. package/compodoc/components/NavigationComponent.html +30 -36
  5. package/compodoc/components/NavigationItemComponent.html +31 -36
  6. package/compodoc/components/SettingsButtonComponent.html +46 -46
  7. package/compodoc/components/SidenavComponent.html +43 -44
  8. package/compodoc/dependencies.html +20 -20
  9. package/compodoc/js/search/search_index.js +2 -2
  10. package/compodoc/properties.html +1 -1
  11. package/docs/documentation.json +2065 -2005
  12. package/docs/html/classes/AppsButtonComponent.html +4 -4
  13. package/docs/html/classes/BaseLayoutComponent.html +2 -2
  14. package/docs/html/classes/DefaultHeaderComponent.html +2 -2
  15. package/docs/html/classes/DefaultHeaderService.html +5 -5
  16. package/docs/html/classes/ExternalAppsService.html +2 -2
  17. package/docs/html/classes/FooterComponent.html +2 -2
  18. package/docs/html/classes/FooterDirective.html +3 -3
  19. package/docs/html/classes/FooterService.html +5 -5
  20. package/docs/html/classes/HeaderComponent.html +2 -2
  21. package/docs/html/classes/HeaderDirective.html +3 -3
  22. package/docs/html/classes/HeaderService.html +5 -5
  23. package/docs/html/classes/LayoutComponent.html +2 -2
  24. package/docs/html/classes/LayoutService.html +2 -2
  25. package/docs/html/classes/LogoService.html +2 -2
  26. package/docs/html/classes/MinimalLayoutComponent.html +2 -2
  27. package/docs/html/classes/NavigationComponent.html +3 -3
  28. package/docs/html/classes/NavigationItemComponent.html +6 -6
  29. package/docs/html/classes/NavigationProgressBarComponent.html +2 -2
  30. package/docs/html/classes/NavigationService.html +3 -3
  31. package/docs/html/classes/ReleaseInfoComponent.html +2 -2
  32. package/docs/html/classes/SettingsButtonComponent.html +2 -2
  33. package/docs/html/classes/SidenavComponent.html +3 -3
  34. package/docs/html/classes/SidenavFooterDirective.html +2 -2
  35. package/docs/html/classes/SidenavHeaderDirective.html +2 -2
  36. package/docs/html/classes/SidenavToggleButtonComponent.html +2 -2
  37. package/docs/html/classes/UserProfileIconComponent.html +2 -2
  38. package/docs/html/functions/IsNavigationDividerItem.html +1 -1
  39. package/docs/html/functions/IsNavigationInsertItem.html +1 -1
  40. package/docs/html/functions/IsNavigationItem.html +1 -1
  41. package/docs/html/functions/provideExternalApps.html +1 -1
  42. package/docs/html/functions/provideLayout.html +1 -1
  43. package/docs/html/functions/withDefaultHeaderComponent.html +1 -1
  44. package/docs/html/functions/withDefaultHeaderItems.html +1 -1
  45. package/docs/html/functions/withFooterComponents.html +1 -1
  46. package/docs/html/functions/withHeaderComponents.html +1 -1
  47. package/docs/html/functions/withNavigationConfig.html +1 -1
  48. package/docs/html/functions/withNavigationInserts.html +1 -1
  49. package/docs/html/functions/withReleaseInfoModules.html +1 -1
  50. package/docs/html/functions/withSettingsMenuItems.html +1 -1
  51. package/docs/html/functions/withUserProfileDataSource.html +1 -1
  52. package/docs/html/index.html +2 -2
  53. package/docs/html/interfaces/NavigationDividerItem.html +2 -2
  54. package/docs/html/interfaces/NavigationInsertItem.html +2 -2
  55. package/docs/html/interfaces/NavigationItem.html +2 -2
  56. package/docs/html/interfaces/NavigationStatus.html +2 -2
  57. package/docs/html/interfaces/ReleaseInfoModule.html +2 -2
  58. package/docs/html/interfaces/SettingsMenuItem.html +2 -2
  59. package/docs/html/modules.html +1 -1
  60. package/docs/html/types/DefaultHeaderItemComponent.html +1 -1
  61. package/docs/html/types/ExternalApp.html +1 -1
  62. package/docs/html/types/ExtractUsernameFromProfileFn.html +1 -1
  63. package/docs/html/types/Navigation.html +1 -1
  64. package/docs/html/types/NavigationWithInserts.html +1 -1
  65. package/docs/html/types/SettingsMenuItemComponent.html +1 -1
  66. package/docs/html/variables/EXTRACT_USERNAME_FROM_PROFILE.html +1 -1
  67. package/docs/html/variables/RXAP_DEFAULT_HEADER_ITEM_COMPONENT.html +1 -1
  68. package/docs/html/variables/RXAP_EXTERNAL_APP.html +1 -1
  69. package/docs/html/variables/RXAP_EXTERNAL_APP_FILTER.html +1 -1
  70. package/docs/html/variables/RXAP_FOOTER_COMPONENT.html +1 -1
  71. package/docs/html/variables/RXAP_HEADER_COMPONENT.html +1 -1
  72. package/docs/html/variables/RXAP_LAYOUT_APPS_GRID.html +1 -1
  73. package/docs/html/variables/RXAP_LOGO_CONFIG.html +1 -1
  74. package/docs/html/variables/RXAP_LOGO_CONFIG_DEFAULTS.html +1 -1
  75. package/docs/html/variables/RXAP_NAVIGATION_CONFIG.html +1 -1
  76. package/docs/html/variables/RXAP_NAVIGATION_CONFIG_INSERTS.html +1 -1
  77. package/docs/html/variables/RXAP_NAVIGATION_LAYOUT_CONFIG_DEFAULTS.html +1 -1
  78. package/docs/html/variables/RXAP_RELEASE_INFO_MODULE.html +1 -1
  79. package/docs/html/variables/RXAP_SETTINGS_MENU_ITEM.html +1 -1
  80. package/docs/html/variables/RXAP_SETTINGS_MENU_ITEM_COMPONENT.html +1 -1
  81. package/docs/html/variables/RXAP_USER_PROFILE_DATA_SOURCE.html +1 -1
  82. package/docs/markdown/README.md +1 -1
  83. package/docs/markdown/classes/AppsButtonComponent.md +8 -8
  84. package/docs/markdown/classes/BaseLayoutComponent.md +2 -2
  85. package/docs/markdown/classes/DefaultHeaderComponent.md +10 -10
  86. package/docs/markdown/classes/DefaultHeaderService.md +6 -6
  87. package/docs/markdown/classes/ExternalAppsService.md +18 -18
  88. package/docs/markdown/classes/FooterComponent.md +5 -5
  89. package/docs/markdown/classes/FooterDirective.md +4 -4
  90. package/docs/markdown/classes/FooterService.md +6 -6
  91. package/docs/markdown/classes/HeaderComponent.md +6 -6
  92. package/docs/markdown/classes/HeaderDirective.md +4 -4
  93. package/docs/markdown/classes/HeaderService.md +6 -6
  94. package/docs/markdown/classes/LayoutComponent.md +6 -6
  95. package/docs/markdown/classes/LayoutService.md +17 -17
  96. package/docs/markdown/classes/LogoService.md +6 -6
  97. package/docs/markdown/classes/MinimalLayoutComponent.md +2 -2
  98. package/docs/markdown/classes/NavigationComponent.md +14 -14
  99. package/docs/markdown/classes/NavigationItemComponent.md +20 -22
  100. package/docs/markdown/classes/NavigationProgressBarComponent.md +4 -4
  101. package/docs/markdown/classes/NavigationService.md +12 -12
  102. package/docs/markdown/classes/ReleaseInfoComponent.md +6 -6
  103. package/docs/markdown/classes/SettingsButtonComponent.md +19 -19
  104. package/docs/markdown/classes/SidenavComponent.md +18 -18
  105. package/docs/markdown/classes/SidenavFooterDirective.md +4 -4
  106. package/docs/markdown/classes/SidenavHeaderDirective.md +4 -4
  107. package/docs/markdown/classes/SidenavToggleButtonComponent.md +5 -5
  108. package/docs/markdown/classes/UserProfileIconComponent.md +7 -7
  109. package/docs/markdown/functions/IsNavigationDividerItem.md +2 -2
  110. package/docs/markdown/functions/IsNavigationInsertItem.md +2 -2
  111. package/docs/markdown/functions/IsNavigationItem.md +2 -2
  112. package/docs/markdown/functions/provideExternalApps.md +2 -2
  113. package/docs/markdown/functions/provideLayout.md +2 -2
  114. package/docs/markdown/functions/withDefaultHeaderComponent.md +2 -2
  115. package/docs/markdown/functions/withDefaultHeaderItems.md +2 -2
  116. package/docs/markdown/functions/withFooterComponents.md +2 -2
  117. package/docs/markdown/functions/withHeaderComponents.md +2 -2
  118. package/docs/markdown/functions/withNavigationConfig.md +2 -2
  119. package/docs/markdown/functions/withNavigationInserts.md +2 -2
  120. package/docs/markdown/functions/withReleaseInfoModules.md +2 -2
  121. package/docs/markdown/functions/withSettingsMenuItems.md +2 -2
  122. package/docs/markdown/functions/withUserProfileDataSource.md +2 -2
  123. package/docs/markdown/globals.md +2 -2
  124. package/docs/markdown/interfaces/NavigationDividerItem.md +4 -4
  125. package/docs/markdown/interfaces/NavigationInsertItem.md +3 -3
  126. package/docs/markdown/interfaces/NavigationItem.md +8 -8
  127. package/docs/markdown/interfaces/NavigationStatus.md +3 -3
  128. package/docs/markdown/interfaces/ReleaseInfoModule.md +5 -5
  129. package/docs/markdown/interfaces/SettingsMenuItem.md +5 -5
  130. package/docs/markdown/type-aliases/DefaultHeaderItemComponent.md +2 -2
  131. package/docs/markdown/type-aliases/ExternalApp.md +2 -2
  132. package/docs/markdown/type-aliases/ExtractUsernameFromProfileFn.md +2 -2
  133. package/docs/markdown/type-aliases/Navigation.md +2 -2
  134. package/docs/markdown/type-aliases/NavigationWithInserts.md +2 -2
  135. package/docs/markdown/type-aliases/SettingsMenuItemComponent.md +2 -2
  136. package/docs/markdown/variables/EXTRACT_USERNAME_FROM_PROFILE.md +2 -2
  137. package/docs/markdown/variables/RXAP_DEFAULT_HEADER_ITEM_COMPONENT.md +2 -2
  138. package/docs/markdown/variables/RXAP_EXTERNAL_APP.md +2 -2
  139. package/docs/markdown/variables/RXAP_EXTERNAL_APP_FILTER.md +2 -2
  140. package/docs/markdown/variables/RXAP_FOOTER_COMPONENT.md +2 -2
  141. package/docs/markdown/variables/RXAP_HEADER_COMPONENT.md +2 -2
  142. package/docs/markdown/variables/RXAP_LAYOUT_APPS_GRID.md +2 -2
  143. package/docs/markdown/variables/RXAP_LOGO_CONFIG.md +2 -2
  144. package/docs/markdown/variables/RXAP_LOGO_CONFIG_DEFAULTS.md +2 -2
  145. package/docs/markdown/variables/RXAP_NAVIGATION_CONFIG.md +2 -2
  146. package/docs/markdown/variables/RXAP_NAVIGATION_CONFIG_INSERTS.md +2 -2
  147. package/docs/markdown/variables/RXAP_NAVIGATION_LAYOUT_CONFIG_DEFAULTS.md +2 -2
  148. package/docs/markdown/variables/RXAP_RELEASE_INFO_MODULE.md +2 -2
  149. package/docs/markdown/variables/RXAP_SETTINGS_MENU_ITEM.md +2 -2
  150. package/docs/markdown/variables/RXAP_SETTINGS_MENU_ITEM_COMPONENT.md +2 -2
  151. package/docs/markdown/variables/RXAP_USER_PROFILE_DATA_SOURCE.md +2 -2
  152. package/docs/wiki/Class.AppsButtonComponent.md +7 -7
  153. package/docs/wiki/Class.BaseLayoutComponent.md +1 -1
  154. package/docs/wiki/Class.DefaultHeaderComponent.md +9 -9
  155. package/docs/wiki/Class.DefaultHeaderService.md +5 -5
  156. package/docs/wiki/Class.ExternalAppsService.md +17 -17
  157. package/docs/wiki/Class.FooterComponent.md +4 -4
  158. package/docs/wiki/Class.FooterDirective.md +3 -3
  159. package/docs/wiki/Class.FooterService.md +5 -5
  160. package/docs/wiki/Class.HeaderComponent.md +5 -5
  161. package/docs/wiki/Class.HeaderDirective.md +3 -3
  162. package/docs/wiki/Class.HeaderService.md +5 -5
  163. package/docs/wiki/Class.LayoutComponent.md +5 -5
  164. package/docs/wiki/Class.LayoutService.md +16 -16
  165. package/docs/wiki/Class.LogoService.md +5 -5
  166. package/docs/wiki/Class.MinimalLayoutComponent.md +1 -1
  167. package/docs/wiki/Class.NavigationComponent.md +13 -13
  168. package/docs/wiki/Class.NavigationItemComponent.md +19 -21
  169. package/docs/wiki/Class.NavigationProgressBarComponent.md +3 -3
  170. package/docs/wiki/Class.NavigationService.md +11 -11
  171. package/docs/wiki/Class.ReleaseInfoComponent.md +5 -5
  172. package/docs/wiki/Class.SettingsButtonComponent.md +18 -18
  173. package/docs/wiki/Class.SidenavComponent.md +17 -17
  174. package/docs/wiki/Class.SidenavFooterDirective.md +3 -3
  175. package/docs/wiki/Class.SidenavHeaderDirective.md +3 -3
  176. package/docs/wiki/Class.SidenavToggleButtonComponent.md +4 -4
  177. package/docs/wiki/Class.UserProfileIconComponent.md +6 -6
  178. package/docs/wiki/Function.IsNavigationDividerItem.md +1 -1
  179. package/docs/wiki/Function.IsNavigationInsertItem.md +1 -1
  180. package/docs/wiki/Function.IsNavigationItem.md +1 -1
  181. package/docs/wiki/Function.provideExternalApps.md +1 -1
  182. package/docs/wiki/Function.provideLayout.md +1 -1
  183. package/docs/wiki/Function.withDefaultHeaderComponent.md +1 -1
  184. package/docs/wiki/Function.withDefaultHeaderItems.md +1 -1
  185. package/docs/wiki/Function.withFooterComponents.md +1 -1
  186. package/docs/wiki/Function.withHeaderComponents.md +1 -1
  187. package/docs/wiki/Function.withNavigationConfig.md +1 -1
  188. package/docs/wiki/Function.withNavigationInserts.md +1 -1
  189. package/docs/wiki/Function.withReleaseInfoModules.md +1 -1
  190. package/docs/wiki/Function.withSettingsMenuItems.md +1 -1
  191. package/docs/wiki/Function.withUserProfileDataSource.md +1 -1
  192. package/docs/wiki/Interface.NavigationDividerItem.md +3 -3
  193. package/docs/wiki/Interface.NavigationInsertItem.md +2 -2
  194. package/docs/wiki/Interface.NavigationItem.md +7 -7
  195. package/docs/wiki/Interface.NavigationStatus.md +2 -2
  196. package/docs/wiki/Interface.ReleaseInfoModule.md +4 -4
  197. package/docs/wiki/Interface.SettingsMenuItem.md +4 -4
  198. package/docs/wiki/TypeAlias.DefaultHeaderItemComponent.md +1 -1
  199. package/docs/wiki/TypeAlias.ExternalApp.md +1 -1
  200. package/docs/wiki/TypeAlias.ExtractUsernameFromProfileFn.md +1 -1
  201. package/docs/wiki/TypeAlias.Navigation.md +1 -1
  202. package/docs/wiki/TypeAlias.NavigationWithInserts.md +1 -1
  203. package/docs/wiki/TypeAlias.SettingsMenuItemComponent.md +1 -1
  204. package/docs/wiki/Variable.EXTRACT_USERNAME_FROM_PROFILE.md +1 -1
  205. package/docs/wiki/Variable.RXAP_DEFAULT_HEADER_ITEM_COMPONENT.md +1 -1
  206. package/docs/wiki/Variable.RXAP_EXTERNAL_APP.md +1 -1
  207. package/docs/wiki/Variable.RXAP_EXTERNAL_APP_FILTER.md +1 -1
  208. package/docs/wiki/Variable.RXAP_FOOTER_COMPONENT.md +1 -1
  209. package/docs/wiki/Variable.RXAP_HEADER_COMPONENT.md +1 -1
  210. package/docs/wiki/Variable.RXAP_LAYOUT_APPS_GRID.md +1 -1
  211. package/docs/wiki/Variable.RXAP_LOGO_CONFIG.md +1 -1
  212. package/docs/wiki/Variable.RXAP_LOGO_CONFIG_DEFAULTS.md +1 -1
  213. package/docs/wiki/Variable.RXAP_NAVIGATION_CONFIG.md +1 -1
  214. package/docs/wiki/Variable.RXAP_NAVIGATION_CONFIG_INSERTS.md +1 -1
  215. package/docs/wiki/Variable.RXAP_NAVIGATION_LAYOUT_CONFIG_DEFAULTS.md +1 -1
  216. package/docs/wiki/Variable.RXAP_RELEASE_INFO_MODULE.md +1 -1
  217. package/docs/wiki/Variable.RXAP_SETTINGS_MENU_ITEM.md +1 -1
  218. package/docs/wiki/Variable.RXAP_SETTINGS_MENU_ITEM_COMPONENT.md +1 -1
  219. package/docs/wiki/Variable.RXAP_USER_PROFILE_DATA_SOURCE.md +1 -1
  220. package/docs/wiki/globals.md +1 -1
  221. package/fesm2022/rxap-layout.mjs +155 -161
  222. package/fesm2022/rxap-layout.mjs.map +1 -1
  223. package/package.json +47 -46
  224. package/src/generators/init/generator.ts +139 -0
  225. package/src/generators/init/index.ts +5 -0
  226. package/src/generators/init/schema.d.ts +2 -0
  227. package/src/generators/init/schema.json +8 -0
  228. package/{index.d.ts → src/index.ts} +47 -0
  229. package/src/migrations/18.0.0/add-seperate-external-apps-provider/__snapshots__/add-seperate-external-apps-provider.spec.ts.snap +1 -1
  230. package/src/migrations/18.0.0/add-seperate-external-apps-provider/add-seperate-external-apps-provider.spec.ts +63 -0
  231. package/src/migrations/18.0.0/add-seperate-external-apps-provider/add-seperate-external-apps-provider.ts +59 -0
  232. package/src/migrations/18.0.0/add-theme-provider-to-app-config/__snapshots__/add-theme-provider-to-app-config.spec.ts.snap +1 -1
  233. package/src/migrations/18.0.0/add-theme-provider-to-app-config/add-theme-provider-to-app-config.spec.ts +61 -0
  234. package/src/migrations/18.0.0/add-theme-provider-to-app-config/add-theme-provider-to-app-config.ts +44 -0
  235. package/src/migrations/18.0.0/add-user-theme-provider-to-layout-providers/__snapshots__/add-user-theme-provider-to-layout-providers.spec.ts.snap +1 -1
  236. package/src/migrations/18.0.0/add-user-theme-provider-to-layout-providers/add-user-theme-provider-to-layout-providers.spec.ts +94 -0
  237. package/src/migrations/18.0.0/add-user-theme-provider-to-layout-providers/add-user-theme-provider-to-layout-providers.ts +51 -0
  238. package/src/migrations/18.0.0/add-with-user-profile-provider/__snapshots__/add-with-user-profile-provider.spec.ts.snap +1 -1
  239. package/src/migrations/18.0.0/add-with-user-profile-provider/add-with-user-profile-provider.spec.ts +94 -0
  240. package/src/migrations/18.0.0/add-with-user-profile-provider/add-with-user-profile-provider.ts +53 -0
  241. package/src/test-setup.ts +25 -0
  242. package/types/rxap-layout.d.ts +509 -0
  243. package/lib/base-layout/base-layout.component.d.ts +0 -5
  244. package/lib/default-header/apps-button/apps-button.component.d.ts +0 -16
  245. package/lib/default-header/default-header.component.d.ts +0 -15
  246. package/lib/default-header/default-header.service.d.ts +0 -36
  247. package/lib/default-header/settings-button/settings-button.component.d.ts +0 -33
  248. package/lib/default-header/sidenav-toggle-button/sidenav-toggle-button.component.d.ts +0 -9
  249. package/lib/default-header/user-profile-icon/user-profile-icon.component.d.ts +0 -12
  250. package/lib/external-apps.service.d.ts +0 -26
  251. package/lib/footer/footer.component.d.ts +0 -9
  252. package/lib/footer/footer.directive.d.ts +0 -12
  253. package/lib/footer.service.d.ts +0 -32
  254. package/lib/header/header.component.d.ts +0 -11
  255. package/lib/header/header.directive.d.ts +0 -12
  256. package/lib/header.service.d.ts +0 -34
  257. package/lib/layout/layout.component.d.ts +0 -11
  258. package/lib/layout.service.d.ts +0 -27
  259. package/lib/logo.service.d.ts +0 -10
  260. package/lib/minimal-layout/minimal-layout.component.d.ts +0 -5
  261. package/lib/navigation/navigation-item/navigation-item.component.d.ts +0 -28
  262. package/lib/navigation/navigation-item.d.ts +0 -25
  263. package/lib/navigation/navigation.component.d.ts +0 -21
  264. package/lib/navigation-progress-bar/navigation-progress-bar.component.d.ts +0 -8
  265. package/lib/navigation.service.d.ts +0 -36
  266. package/lib/provide.d.ts +0 -17
  267. package/lib/release-info/release-info.component.d.ts +0 -10
  268. package/lib/sidenav/sidenav-footer.directive.d.ts +0 -8
  269. package/lib/sidenav/sidenav-header.directive.d.ts +0 -8
  270. package/lib/sidenav/sidenav.component.d.ts +0 -31
  271. package/lib/tokens.d.ts +0 -22
  272. package/lib/types.d.ts +0 -17
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`add-user-theme-provider-to-app-config migration should run successfully 1`] = `
4
4
  "export const ROUTES: Route[] = [
@@ -0,0 +1,94 @@
1
+ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
2
+ import {
3
+ addProjectConfiguration,
4
+ Tree,
5
+ } from '@nx/devkit';
6
+ import update from './add-user-theme-provider-to-layout-providers';
7
+
8
+
9
+ describe('add-user-theme-provider-to-app-config migration', () => {
10
+ let tree: Tree;
11
+
12
+ beforeEach(() => {
13
+ tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
14
+ addProjectConfiguration(tree, 'service', {
15
+ root: 'apps/service',
16
+ projectType: 'application',
17
+ sourceRoot: 'apps/service/src',
18
+ tags: [ 'service' ],
19
+ targets: {},
20
+ });
21
+ addProjectConfiguration(tree, 'angularA', {
22
+ root: 'apps/angularA',
23
+ projectType: 'application',
24
+ sourceRoot: 'apps/angularA/src',
25
+ tags: [ 'angular' ],
26
+ targets: {},
27
+ });
28
+ addProjectConfiguration(tree, 'angularB', {
29
+ root: 'apps/angularB',
30
+ projectType: 'application',
31
+ sourceRoot: 'apps/angularB/src',
32
+ tags: [ 'angular' ],
33
+ targets: {},
34
+ });
35
+ tree.write('apps/angularB/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
36
+ {
37
+ path: '',
38
+ component: LayoutComponent,
39
+ children: [],
40
+ providers: []
41
+ }
42
+ ];
43
+
44
+ export default ROUTES;`);
45
+ addProjectConfiguration(tree, 'angularC', {
46
+ root: 'apps/angularC',
47
+ projectType: 'application',
48
+ sourceRoot: 'apps/angularC/src',
49
+ tags: [ 'angular' ],
50
+ targets: {},
51
+ });
52
+ tree.write('apps/angularC/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
53
+ {
54
+ path: '',
55
+ component: LayoutComponent,
56
+ children: [],
57
+ providers: [
58
+ provideLayout()
59
+ ]
60
+ }
61
+ ];
62
+
63
+ export default ROUTES;`);
64
+ addProjectConfiguration(tree, 'angularD', {
65
+ root: 'apps/angularD',
66
+ projectType: 'application',
67
+ sourceRoot: 'apps/angularD/src',
68
+ tags: [ 'angular' ],
69
+ targets: {},
70
+ });
71
+ tree.write('apps/angularD/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
72
+ {
73
+ path: '',
74
+ component: LayoutComponent,
75
+ children: [],
76
+ providers: [
77
+ provideLayout(
78
+ withNavigationConfig(APP_NAVIGATION),
79
+ withDefaultHeaderComponent()
80
+ )
81
+ ]
82
+ }
83
+ ];
84
+
85
+ export default ROUTES;`);
86
+ });
87
+
88
+ it('should run successfully', async () => {
89
+ await update(tree);
90
+ expect(tree.read('apps/angularB/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
91
+ expect(tree.read('apps/angularC/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
92
+ expect(tree.read('apps/angularD/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
93
+ });
94
+ });
@@ -0,0 +1,51 @@
1
+ import {
2
+ getProjects,
3
+ Tree,
4
+ } from '@nx/devkit';
5
+ import {
6
+ CoerceAppConfigProvider,
7
+ CoerceImports,
8
+ } from '@rxap/ts-morph';
9
+ import { TsMorphAngularProjectTransform } from '@rxap/workspace-ts-morph';
10
+ import {
11
+ GetProjectSourceRoot,
12
+ IsAngularProject,
13
+ IsApplicationProject,
14
+ } from '@rxap/workspace-utilities';
15
+
16
+ export default async function update(host: Tree) {
17
+
18
+ for (const [ projectName, project ] of getProjects(host)) {
19
+ if (!IsApplicationProject(project) || !IsAngularProject(project)) {
20
+ continue;
21
+ }
22
+ const projectSourceRoot = GetProjectSourceRoot(host, projectName);
23
+ const layoutRoutesPath = `${ projectSourceRoot }/app/layout.routes.ts`;
24
+ if (!host.exists(layoutRoutesPath)) {
25
+ console.log(`The project ${ projectName } does not have a layout.routes.ts file. Skip Migration`);
26
+ continue;
27
+ }
28
+ let content = host.read(layoutRoutesPath, 'utf-8');
29
+ if (!content?.includes('provideLayout(')) {
30
+ console.log(`The project ${ projectName } does not have the provideLayout provider. Skip Migration`);
31
+ continue;
32
+ }
33
+ if (content.includes('provideUserTheme(')) {
34
+ console.log(`The project ${ projectName } already has the provideUserTheme provider. Skip Migration`);
35
+ continue;
36
+ }
37
+ content = content.replace('provideLayout(', 'provideUserTheme(), provideLayout(');
38
+ host.write(layoutRoutesPath, content);
39
+ await TsMorphAngularProjectTransform(host, {
40
+ project: projectName,
41
+ }, (_, [ sourceFile ]) => {
42
+ CoerceImports(sourceFile, [
43
+ {
44
+ moduleSpecifier: '@rxap/ngx-user',
45
+ namedImports: [ 'provideUserTheme' ],
46
+ },
47
+ ]);
48
+ }, [ '/app/layout.routes.ts' ]);
49
+ }
50
+
51
+ }
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`add-with-user-profile-provider migration should run successfully 1`] = `
4
4
  "export const ROUTES: Route[] = [
@@ -0,0 +1,94 @@
1
+ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
2
+ import {
3
+ addProjectConfiguration,
4
+ Tree,
5
+ } from '@nx/devkit';
6
+
7
+ import update from './add-with-user-profile-provider';
8
+
9
+ describe('add-with-user-profile-provider migration', () => {
10
+ let tree: Tree;
11
+
12
+ beforeEach(() => {
13
+ tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
14
+ addProjectConfiguration(tree, 'service', {
15
+ root: 'apps/service',
16
+ projectType: 'application',
17
+ sourceRoot: 'apps/service/src',
18
+ tags: [ 'service' ],
19
+ targets: {},
20
+ });
21
+ addProjectConfiguration(tree, 'angularA', {
22
+ root: 'apps/angularA',
23
+ projectType: 'application',
24
+ sourceRoot: 'apps/angularA/src',
25
+ tags: [ 'angular' ],
26
+ targets: {},
27
+ });
28
+ addProjectConfiguration(tree, 'angularB', {
29
+ root: 'apps/angularB',
30
+ projectType: 'application',
31
+ sourceRoot: 'apps/angularB/src',
32
+ tags: [ 'angular' ],
33
+ targets: {},
34
+ });
35
+ tree.write('apps/angularB/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
36
+ {
37
+ path: '',
38
+ component: LayoutComponent,
39
+ children: [],
40
+ providers: []
41
+ }
42
+ ];
43
+
44
+ export default ROUTES;`);
45
+ addProjectConfiguration(tree, 'angularC', {
46
+ root: 'apps/angularC',
47
+ projectType: 'application',
48
+ sourceRoot: 'apps/angularC/src',
49
+ tags: [ 'angular' ],
50
+ targets: {},
51
+ });
52
+ tree.write('apps/angularC/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
53
+ {
54
+ path: '',
55
+ component: LayoutComponent,
56
+ children: [],
57
+ providers: [
58
+ provideLayout()
59
+ ]
60
+ }
61
+ ];
62
+
63
+ export default ROUTES;`);
64
+ addProjectConfiguration(tree, 'angularD', {
65
+ root: 'apps/angularD',
66
+ projectType: 'application',
67
+ sourceRoot: 'apps/angularD/src',
68
+ tags: [ 'angular' ],
69
+ targets: {},
70
+ });
71
+ tree.write('apps/angularD/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
72
+ {
73
+ path: '',
74
+ component: LayoutComponent,
75
+ children: [],
76
+ providers: [
77
+ provideLayout(
78
+ withNavigationConfig(APP_NAVIGATION),
79
+ withDefaultHeaderComponent()
80
+ )
81
+ ]
82
+ }
83
+ ];
84
+
85
+ export default ROUTES;`);
86
+ });
87
+
88
+ it('should run successfully', async () => {
89
+ await update(tree);
90
+ expect(tree.read('apps/angularB/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
91
+ expect(tree.read('apps/angularC/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
92
+ expect(tree.read('apps/angularD/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
93
+ });
94
+ });
@@ -0,0 +1,53 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import {
3
+ getProjects,
4
+ Tree,
5
+ } from '@nx/devkit';
6
+ import { CoerceImports } from '@rxap/ts-morph';
7
+ import { TsMorphAngularProjectTransform } from '@rxap/workspace-ts-morph';
8
+ import {
9
+ GetProjectSourceRoot,
10
+ IsAngularProject,
11
+ IsApplicationProject,
12
+ } from '@rxap/workspace-utilities';
13
+
14
+ export default async function update(host: Tree) {
15
+
16
+ for (const [ projectName, project ] of getProjects(host)) {
17
+ if (!IsApplicationProject(project) || !IsAngularProject(project)) {
18
+ continue;
19
+ }
20
+ const projectSourceRoot = GetProjectSourceRoot(host, projectName);
21
+ const layoutRoutesPath = `${ projectSourceRoot }/app/layout.routes.ts`;
22
+ if (!host.exists(layoutRoutesPath)) {
23
+ console.log(`The project ${ projectName } does not have a layout.routes.ts file. Skip Migration`);
24
+ continue;
25
+ }
26
+ let content = host.read(layoutRoutesPath, 'utf-8');
27
+ if (!content?.includes('provideLayout(')) {
28
+ console.log(`The project ${ projectName } does not have the provideLayout provider. Skip Migration`);
29
+ continue;
30
+ }
31
+ if (content.includes('withUserProfileDataSource(')) {
32
+ console.log(`The project ${ projectName } already has the withUserProfileDataSource provider. Skip Migration`);
33
+ continue;
34
+ }
35
+ content = content.replace('provideLayout(', 'provideLayout(withUserProfileDataSource(UserProfileDataSource),');
36
+ host.write(layoutRoutesPath, content);
37
+ await TsMorphAngularProjectTransform(host, {
38
+ project: projectName,
39
+ }, (_, [ sourceFile ]) => {
40
+ CoerceImports(sourceFile, [
41
+ {
42
+ moduleSpecifier: '@rxap/ngx-user',
43
+ namedImports: [ 'UserProfileDataSource' ],
44
+ },
45
+ {
46
+ moduleSpecifier: '@rxap/layout',
47
+ namedImports: [ 'withUserProfileDataSource' ],
48
+ },
49
+ ]);
50
+ }, [ '/app/layout.routes.ts' ]);
51
+ }
52
+
53
+ }
@@ -0,0 +1,25 @@
1
+ // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
2
+ globalThis.ngJest = {
3
+ testEnvironmentOptions: {
4
+ errorOnUnknownElements: true,
5
+ errorOnUnknownProperties: true,
6
+ },
7
+ };
8
+ import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
9
+
10
+ setupZoneTestEnv();
11
+ import { TextDecoder, TextEncoder } from 'util';
12
+ global.TextEncoder ??= TextEncoder as any;
13
+ global.TextDecoder ??= TextDecoder as any;
14
+
15
+ import '@angular/localize/init';
16
+ jest.spyOn(global as any, '$localize').mockImplementation((...args: any[]) => {
17
+ // This template tag function just returns the first argument with no transformations.
18
+ // Change this to fit your unit test needs.
19
+ return args[0];
20
+ });
21
+
22
+ jest.mock('prettier', () => ({
23
+ format: (str: string) => str,
24
+ resolveConfig: () => Promise.resolve({}),
25
+ }));