@worktile/planet 12.1.0 → 12.1.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 (329) hide show
  1. package/.all-contributorsrc +84 -0
  2. package/.circleci/config.yml +17 -0
  3. package/.coveralls.yml +1 -0
  4. package/.docgeni/public/assets/favicon.ico +0 -0
  5. package/.docgeni/public/index.html +13 -0
  6. package/.docgenirc.js +35 -0
  7. package/.dockerignore +1 -0
  8. package/.editorconfig +22 -0
  9. package/.github/FUNDING.yml +12 -0
  10. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  12. package/.prettierignore +7 -0
  13. package/.prettierrc +28 -0
  14. package/.travis.yml +26 -0
  15. package/.wpmrc.js +11 -0
  16. package/CHANGELOG.md +391 -0
  17. package/CODE_OF_CONDUCT.md +76 -0
  18. package/Dockerfile +11 -0
  19. package/LICENSE +21 -0
  20. package/README.md +348 -0
  21. package/README.zh-CN.md +307 -0
  22. package/SECURITY.md +21 -0
  23. package/angular.json +373 -0
  24. package/commitlint.config.js +6 -0
  25. package/docs/api/defineApplication.md +46 -0
  26. package/docs/api/globalEventDispatcher.md +51 -0
  27. package/docs/api/index.md +5 -0
  28. package/docs/api/planet.md +117 -0
  29. package/docs/guides/getting-started.md +174 -0
  30. package/docs/guides/index.md +5 -0
  31. package/docs/guides/intro.md +216 -0
  32. package/examples/app1/browserslist +11 -0
  33. package/examples/app1/extra-webpack.config.js +33 -0
  34. package/examples/app1/karma.conf.js +31 -0
  35. package/examples/app1/postcss.config.js +1 -0
  36. package/examples/app1/src/app/app.module.ts +44 -0
  37. package/examples/app1/src/app/app.routing.ts +49 -0
  38. package/examples/app1/src/app/counter.service.ts +16 -0
  39. package/examples/app1/src/app/dashboard/dashboard.component.html +51 -0
  40. package/examples/app1/src/app/dashboard/dashboard.component.ts +70 -0
  41. package/examples/app1/src/app/detail/detail.component.html +8 -0
  42. package/examples/app1/src/app/detail/detail.component.ts +18 -0
  43. package/examples/app1/src/app/overlay.ts +26 -0
  44. package/examples/app1/src/app/projects/dialog/projects-dialog.component.html +10 -0
  45. package/examples/app1/src/app/projects/dialog/projects-dialog.component.ts +41 -0
  46. package/examples/app1/src/app/projects/projects.component.ts +33 -0
  47. package/examples/app1/src/app/root/root.component.css +3 -0
  48. package/examples/app1/src/app/root/root.component.html +16 -0
  49. package/examples/app1/src/app/root/root.component.ts +35 -0
  50. package/examples/app1/src/app/services/initialized-data.resolver.ts +15 -0
  51. package/examples/app1/src/app/shared.module.ts +57 -0
  52. package/examples/app1/src/app/user/detail/user-detail.component.html +5 -0
  53. package/examples/app1/src/app/user/detail/user-detail.component.ts +20 -0
  54. package/examples/app1/src/app/user/user-list.component.html +7 -0
  55. package/examples/app1/src/app/user/user-list.component.ts +20 -0
  56. package/examples/app1/src/app/user/user.module.ts +31 -0
  57. package/examples/app1/src/assets/.gitkeep +0 -0
  58. package/examples/app1/src/assets/github.png +0 -0
  59. package/examples/app1/src/assets/main.css +3 -0
  60. package/examples/app1/src/environments/environment.prod.ts +3 -0
  61. package/examples/app1/src/environments/environment.ts +16 -0
  62. package/examples/app1/src/favicon.ico +0 -0
  63. package/examples/app1/src/index.html +14 -0
  64. package/examples/app1/src/main.ts +35 -0
  65. package/examples/app1/src/polyfills.ts +84 -0
  66. package/examples/app1/src/styles.scss +35 -0
  67. package/examples/app1/src/test.ts +14 -0
  68. package/examples/app1/temp.js +221 -0
  69. package/examples/app1/tsconfig.app.json +10 -0
  70. package/examples/app1/tsconfig.spec.json +18 -0
  71. package/examples/app1/tslint.json +17 -0
  72. package/examples/app1/webpack.config.js +127 -0
  73. package/examples/app2/browserslist +11 -0
  74. package/examples/app2/extra-webpack.config.js +32 -0
  75. package/examples/app2/karma.conf.js +31 -0
  76. package/examples/app2/src/app/app.module.ts +90 -0
  77. package/examples/app2/src/app/dashboard/dashboard.component.html +21 -0
  78. package/examples/app2/src/app/dashboard/dashboard.component.ts +27 -0
  79. package/examples/app2/src/app/overlay.ts +26 -0
  80. package/examples/app2/src/app/projects/detail/detail.component.html +16 -0
  81. package/examples/app2/src/app/projects/detail/detail.component.ts +21 -0
  82. package/examples/app2/src/app/projects/project-list.component.html +29 -0
  83. package/examples/app2/src/app/projects/project-list.component.ts +58 -0
  84. package/examples/app2/src/app/projects/project.resolver.ts +15 -0
  85. package/examples/app2/src/app/projects/projects.service.ts +28 -0
  86. package/examples/app2/src/app/projects/tasks/tasks.component.html +10 -0
  87. package/examples/app2/src/app/projects/tasks/tasks.component.ts +16 -0
  88. package/examples/app2/src/app/projects/view/view.component.html +1 -0
  89. package/examples/app2/src/app/projects/view/view.component.ts +20 -0
  90. package/examples/app2/src/app/root/root.component.html +14 -0
  91. package/examples/app2/src/app/root/root.component.scss +12 -0
  92. package/examples/app2/src/app/root/root.component.ts +28 -0
  93. package/examples/app2/src/app/shared.module.ts +59 -0
  94. package/examples/app2/src/assets/.gitkeep +0 -0
  95. package/examples/app2/src/environments/environment.prod.ts +3 -0
  96. package/examples/app2/src/environments/environment.ts +16 -0
  97. package/examples/app2/src/favicon.ico +0 -0
  98. package/examples/app2/src/index.html +14 -0
  99. package/examples/app2/src/main.ts +36 -0
  100. package/examples/app2/src/polyfills.ts +84 -0
  101. package/examples/app2/src/styles.scss +28 -0
  102. package/examples/app2/src/test.ts +14 -0
  103. package/examples/app2/tsconfig.app.json +10 -0
  104. package/examples/app2/tsconfig.spec.json +18 -0
  105. package/examples/app2/tslint.json +7 -0
  106. package/examples/app2/webpack.config.js +92 -0
  107. package/examples/common/app-root-context.ts +10 -0
  108. package/examples/common/cache.ts +82 -0
  109. package/examples/common/index.ts +13 -0
  110. package/examples/common/module.ts +10 -0
  111. package/examples/common/overlay-container.service.ts +28 -0
  112. package/examples/common/section-card/section-card.component.html +5 -0
  113. package/examples/common/section-card/section-card.component.scss +15 -0
  114. package/examples/common/section-card/section-card.component.ts +11 -0
  115. package/examples/common/utils.ts +0 -0
  116. package/examples/portal/src/app/a-detail/a-detail.component.html +8 -0
  117. package/examples/portal/src/app/a-detail/a-detail.component.ts +18 -0
  118. package/examples/portal/src/app/about/about.component.html +27 -0
  119. package/examples/portal/src/app/about/about.component.scss +0 -0
  120. package/examples/portal/src/app/about/about.component.spec.ts +26 -0
  121. package/examples/portal/src/app/about/about.component.ts +26 -0
  122. package/examples/portal/src/app/app-routing.module.ts +57 -0
  123. package/examples/portal/src/app/app.component.html +73 -0
  124. package/examples/portal/src/app/app.component.scss +58 -0
  125. package/examples/portal/src/app/app.component.spec.ts +33 -0
  126. package/examples/portal/src/app/app.component.ts +111 -0
  127. package/examples/portal/src/app/app.module.ts +64 -0
  128. package/examples/portal/src/app/custom-settings.service.ts +44 -0
  129. package/examples/portal/src/app/overlay.ts +26 -0
  130. package/examples/portal/src/app/settings/settings.component.html +31 -0
  131. package/examples/portal/src/app/settings/settings.component.scss +3 -0
  132. package/examples/portal/src/app/settings/settings.component.ts +43 -0
  133. package/examples/portal/src/assets/.gitkeep +0 -0
  134. package/examples/portal/src/assets/apps.json +29 -0
  135. package/examples/portal/src/assets/icons/sprite.defs.svg +1 -0
  136. package/examples/portal/src/assets/images/logo.svg +16 -0
  137. package/examples/portal/src/assets/ngx-planet-micro-front-end.gif +0 -0
  138. package/examples/portal/src/browserslist +11 -0
  139. package/examples/portal/src/environments/environment.prod.ts +3 -0
  140. package/examples/portal/src/environments/environment.ts +16 -0
  141. package/examples/portal/src/extra-webpack.config.js +32 -0
  142. package/examples/portal/src/favicon.ico +0 -0
  143. package/examples/portal/src/index.html +14 -0
  144. package/examples/portal/src/karma.conf.js +31 -0
  145. package/examples/portal/src/main.ts +18 -0
  146. package/examples/portal/src/polyfills.ts +84 -0
  147. package/examples/portal/src/reboot.scss +14 -0
  148. package/examples/portal/src/styles.scss +14 -0
  149. package/examples/portal/src/test.ts +14 -0
  150. package/examples/portal/src/tsconfig.app.json +10 -0
  151. package/examples/portal/src/tsconfig.spec.json +9 -0
  152. package/examples/portal/src/tslint.json +7 -0
  153. package/extra-webpack.config.js +5 -0
  154. package/nginx.conf +17 -0
  155. package/package.json +121 -16
  156. package/packages/planet/karma.conf.js +37 -0
  157. package/packages/planet/ng-package.json +7 -0
  158. package/packages/planet/package.json +10 -0
  159. package/packages/planet/src/application/planet-application-loader.spec.ts +1102 -0
  160. package/packages/planet/src/application/planet-application-loader.ts +549 -0
  161. package/packages/planet/src/application/planet-application-ref.spec.ts +233 -0
  162. package/packages/planet/src/application/planet-application-ref.ts +131 -0
  163. package/packages/planet/src/application/planet-application.service.spec.ts +145 -0
  164. package/packages/planet/src/application/planet-application.service.ts +88 -0
  165. package/packages/planet/src/application/portal-application.spec.ts +53 -0
  166. package/packages/planet/src/application/portal-application.ts +28 -0
  167. package/packages/planet/src/assets-loader.spec.ts +689 -0
  168. package/packages/planet/src/assets-loader.ts +247 -0
  169. package/packages/planet/src/component/planet-component-loader.spec.ts +187 -0
  170. package/packages/planet/src/component/planet-component-loader.ts +173 -0
  171. package/packages/planet/src/component/planet-component-ref.ts +8 -0
  172. package/{component/plant-component.config.d.ts → packages/planet/src/component/plant-component.config.ts} +4 -4
  173. package/packages/planet/src/debug.spec.ts +58 -0
  174. package/packages/planet/src/debug.ts +66 -0
  175. package/packages/planet/src/empty/empty.component.spec.ts +34 -0
  176. package/packages/planet/src/empty/empty.component.ts +7 -0
  177. package/packages/planet/src/global-event-dispatcher.spec.ts +81 -0
  178. package/packages/planet/src/global-event-dispatcher.ts +82 -0
  179. package/packages/planet/src/global-planet.spec.ts +39 -0
  180. package/packages/planet/src/global-planet.ts +73 -0
  181. package/packages/planet/src/helpers.spec.ts +242 -0
  182. package/packages/planet/src/helpers.ts +125 -0
  183. package/packages/planet/src/module.spec.ts +79 -0
  184. package/packages/planet/src/module.ts +25 -0
  185. package/{planet.class.d.ts → packages/planet/src/planet.class.ts} +26 -5
  186. package/packages/planet/src/planet.spec.ts +226 -0
  187. package/packages/planet/src/planet.ts +113 -0
  188. package/{public-api.d.ts → packages/planet/src/public-api.ts} +4 -1
  189. package/packages/planet/src/sandbox/constants.ts +6 -0
  190. package/packages/planet/src/sandbox/exec.ts +22 -0
  191. package/packages/planet/src/sandbox/index.ts +24 -0
  192. package/packages/planet/src/sandbox/proxy/patches/document.ts +13 -0
  193. package/packages/planet/src/sandbox/proxy/patches/eventListener.ts +49 -0
  194. package/packages/planet/src/sandbox/proxy/patches/index.ts +13 -0
  195. package/packages/planet/src/sandbox/proxy/patches/storage.ts +53 -0
  196. package/packages/planet/src/sandbox/proxy/patches/timer.ts +50 -0
  197. package/packages/planet/src/sandbox/proxy/proxies/common.ts +137 -0
  198. package/packages/planet/src/sandbox/proxy/proxies/document.ts +140 -0
  199. package/packages/planet/src/sandbox/proxy/proxies/window.ts +176 -0
  200. package/packages/planet/src/sandbox/proxy/proxy-sandbox.ts +59 -0
  201. package/{sandbox/proxy/types.d.ts → packages/planet/src/sandbox/proxy/types.ts} +8 -2
  202. package/packages/planet/src/sandbox/sandbox.ts +20 -0
  203. package/packages/planet/src/sandbox/snapshot/snapshot-sandbox.ts +12 -0
  204. package/packages/planet/src/sandbox/types.ts +1 -0
  205. package/packages/planet/src/test.ts +16 -0
  206. package/packages/planet/src/testing/app1.module.ts +34 -0
  207. package/packages/planet/src/testing/app2.module.ts +24 -0
  208. package/packages/planet/src/testing/applications.ts +58 -0
  209. package/packages/planet/src/testing/index.ts +2 -0
  210. package/packages/planet/src/testing/utils.ts +31 -0
  211. package/packages/planet/tsconfig.lib.json +27 -0
  212. package/packages/planet/tsconfig.lib.prod.json +9 -0
  213. package/packages/planet/tsconfig.spec.json +17 -0
  214. package/packages/planet/tslint.json +7 -0
  215. package/postcss.config.js +3 -0
  216. package/proxy.conf.js +15 -0
  217. package/tsconfig.json +23 -0
  218. package/tslint.json +80 -0
  219. package/application/planet-application-loader.d.ts +0 -70
  220. package/application/planet-application-loader.d.ts.map +0 -1
  221. package/application/planet-application-loader.ngfactory.d.ts.map +0 -1
  222. package/application/planet-application-ref.d.ts +0 -36
  223. package/application/planet-application-ref.d.ts.map +0 -1
  224. package/application/planet-application.service.d.ts +0 -19
  225. package/application/planet-application.service.d.ts.map +0 -1
  226. package/application/planet-application.service.ngfactory.d.ts.map +0 -1
  227. package/application/portal-application.d.ts +0 -15
  228. package/application/portal-application.d.ts.map +0 -1
  229. package/assets-loader.d.ts +0 -33
  230. package/assets-loader.d.ts.map +0 -1
  231. package/assets-loader.ngfactory.d.ts.map +0 -1
  232. package/bundles/worktile-planet.umd.js +0 -2552
  233. package/bundles/worktile-planet.umd.js.map +0 -1
  234. package/component/planet-component-loader.d.ts +0 -28
  235. package/component/planet-component-loader.d.ts.map +0 -1
  236. package/component/planet-component-loader.ngfactory.d.ts.map +0 -1
  237. package/component/planet-component-ref.d.ts +0 -8
  238. package/component/planet-component-ref.d.ts.map +0 -1
  239. package/component/plant-component.config.d.ts.map +0 -1
  240. package/debug.d.ts +0 -22
  241. package/debug.d.ts.map +0 -1
  242. package/empty/empty.component.d.ts +0 -3
  243. package/empty/empty.component.d.ts.map +0 -1
  244. package/empty/empty.component.ngfactory.d.ts.map +0 -1
  245. package/esm2015/application/planet-application-loader.js +0 -452
  246. package/esm2015/application/planet-application-ref.js +0 -94
  247. package/esm2015/application/planet-application.service.js +0 -87
  248. package/esm2015/application/portal-application.js +0 -16
  249. package/esm2015/assets-loader.js +0 -217
  250. package/esm2015/component/planet-component-loader.js +0 -155
  251. package/esm2015/component/planet-component-ref.js +0 -3
  252. package/esm2015/component/plant-component.config.js +0 -7
  253. package/esm2015/debug.js +0 -33
  254. package/esm2015/empty/empty.component.js +0 -10
  255. package/esm2015/global-event-dispatcher.js +0 -71
  256. package/esm2015/global-planet.js +0 -51
  257. package/esm2015/helpers.js +0 -119
  258. package/esm2015/module.js +0 -27
  259. package/esm2015/planet.class.js +0 -9
  260. package/esm2015/planet.js +0 -90
  261. package/esm2015/public-api.js +0 -18
  262. package/esm2015/sandbox/constants.js +0 -7
  263. package/esm2015/sandbox/exec.js +0 -15
  264. package/esm2015/sandbox/index.js +0 -20
  265. package/esm2015/sandbox/proxy/patches/document.js +0 -12
  266. package/esm2015/sandbox/proxy/patches/eventListener.js +0 -41
  267. package/esm2015/sandbox/proxy/patches/index.js +0 -11
  268. package/esm2015/sandbox/proxy/patches/storage.js +0 -40
  269. package/esm2015/sandbox/proxy/patches/timer.js +0 -43
  270. package/esm2015/sandbox/proxy/proxies/common.js +0 -132
  271. package/esm2015/sandbox/proxy/proxies/document.js +0 -126
  272. package/esm2015/sandbox/proxy/proxies/window.js +0 -155
  273. package/esm2015/sandbox/proxy/proxy-sandbox.js +0 -49
  274. package/esm2015/sandbox/proxy/types.js +0 -2
  275. package/esm2015/sandbox/sandbox.js +0 -7
  276. package/esm2015/sandbox/snapshot/snapshot-sandbox.js +0 -12
  277. package/esm2015/sandbox/types.js +0 -2
  278. package/esm2015/worktile-planet.js +0 -6
  279. package/fesm2015/worktile-planet.js +0 -2036
  280. package/fesm2015/worktile-planet.js.map +0 -1
  281. package/global-event-dispatcher.d.ts +0 -20
  282. package/global-event-dispatcher.d.ts.map +0 -1
  283. package/global-event-dispatcher.ngfactory.d.ts.map +0 -1
  284. package/global-planet.d.ts +0 -23
  285. package/global-planet.d.ts.map +0 -1
  286. package/helpers.d.ts +0 -39
  287. package/helpers.d.ts.map +0 -1
  288. package/module.d.ts +0 -6
  289. package/module.d.ts.map +0 -1
  290. package/module.ngfactory.d.ts.map +0 -1
  291. package/planet.class.d.ts.map +0 -1
  292. package/planet.d.ts +0 -25
  293. package/planet.d.ts.map +0 -1
  294. package/planet.ngfactory.d.ts.map +0 -1
  295. package/public-api.d.ts.map +0 -1
  296. package/sandbox/constants.d.ts +0 -7
  297. package/sandbox/constants.d.ts.map +0 -1
  298. package/sandbox/exec.d.ts +0 -3
  299. package/sandbox/exec.d.ts.map +0 -1
  300. package/sandbox/index.d.ts +0 -7
  301. package/sandbox/index.d.ts.map +0 -1
  302. package/sandbox/proxy/patches/document.d.ts +0 -3
  303. package/sandbox/proxy/patches/document.d.ts.map +0 -1
  304. package/sandbox/proxy/patches/eventListener.d.ts +0 -3
  305. package/sandbox/proxy/patches/eventListener.d.ts.map +0 -1
  306. package/sandbox/proxy/patches/index.d.ts +0 -3
  307. package/sandbox/proxy/patches/index.d.ts.map +0 -1
  308. package/sandbox/proxy/patches/storage.d.ts +0 -15
  309. package/sandbox/proxy/patches/storage.d.ts.map +0 -1
  310. package/sandbox/proxy/patches/timer.d.ts +0 -3
  311. package/sandbox/proxy/patches/timer.d.ts.map +0 -1
  312. package/sandbox/proxy/proxies/common.d.ts +0 -13
  313. package/sandbox/proxy/proxies/common.d.ts.map +0 -1
  314. package/sandbox/proxy/proxies/document.d.ts +0 -14
  315. package/sandbox/proxy/proxies/document.d.ts.map +0 -1
  316. package/sandbox/proxy/proxies/window.d.ts +0 -13
  317. package/sandbox/proxy/proxies/window.d.ts.map +0 -1
  318. package/sandbox/proxy/proxy-sandbox.d.ts +0 -16
  319. package/sandbox/proxy/proxy-sandbox.d.ts.map +0 -1
  320. package/sandbox/proxy/types.d.ts.map +0 -1
  321. package/sandbox/sandbox.d.ts +0 -12
  322. package/sandbox/sandbox.d.ts.map +0 -1
  323. package/sandbox/snapshot/snapshot-sandbox.d.ts +0 -9
  324. package/sandbox/snapshot/snapshot-sandbox.d.ts.map +0 -1
  325. package/sandbox/types.d.ts +0 -2
  326. package/sandbox/types.d.ts.map +0 -1
  327. package/worktile-planet.d.ts +0 -6
  328. package/worktile-planet.d.ts.map +0 -1
  329. package/worktile-planet.metadata.json +0 -1
@@ -0,0 +1,92 @@
1
+ // const ngToolsWebpack = require('@ngtools/webpack');
2
+ // const path = require('path');
3
+ // const CopyWebpackPlugin = require('copy-webpack-plugin');
4
+ // const ProgressPlugin = require('webpack/lib/ProgressPlugin');
5
+ // const workspaceRoot = path.resolve(__dirname, './');
6
+ // const projectRoot = path.resolve(__dirname, './');
7
+ // const {
8
+ // IndexHtmlWebpackPlugin
9
+ // } = require('@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin');
10
+ // const WebpackAssetsManifest = require('webpack-assets-manifest');
11
+
12
+ // const config = {
13
+ // mode: 'development',
14
+ // resolve: {
15
+ // extensions: ['.ts', '.js']
16
+ // },
17
+ // context: projectRoot,
18
+ // entry: {
19
+ // main: path.resolve(projectRoot, './src/main.ts'),
20
+ // polyfills: path.resolve(projectRoot, './src/polyfills.ts')
21
+ // },
22
+ // output: {
23
+ // path: path.resolve(workspaceRoot, './dist'),
24
+ // filename: `[name].js`,
25
+ // libraryTarget: 'umd',
26
+ // library: 'app2'
27
+ // },
28
+ // plugins: [
29
+ // new WebpackAssetsManifest(),
30
+ // new ngToolsWebpack.AngularCompilerPlugin({
31
+ // tsConfigPath: path.resolve(projectRoot, './src/tsconfig.app.json'),
32
+ // mainPath: path.resolve(projectRoot, './src/main.ts'),
33
+ // hostReplacementPaths: {
34
+ // './src/environments/environment.ts': './src/environments/environment.prod.ts'
35
+ // },
36
+ // sourceMap: true,
37
+ // compilerOptions: {}
38
+ // }),
39
+ // new IndexHtmlWebpackPlugin({
40
+ // input: path.resolve(__dirname, './src/index.html'),
41
+ // output: path.basename('./src/index.html')
42
+ // // baseHref: buildOptions.baseHref,
43
+ // // entrypoints: generateEntryPoints(buildOptions),
44
+ // // deployUrl: buildOptions.deployUrl,
45
+ // // sri: buildOptions.subresourceIntegrity
46
+ // }),
47
+ // // new HtmlWebpackPlugin({
48
+ // // filename: 'src/index.html'
49
+ // // })
50
+ // new ProgressPlugin()
51
+ // ],
52
+ // module: {
53
+ // rules: [
54
+ // { test: /\.scss$/, loaders: ['raw-loader', 'sass-loader'] },
55
+ // { test: /\.css$/, loader: 'raw-loader' },
56
+ // { test: /\.html$/, loader: 'raw-loader' },
57
+ // {
58
+ // // Mark files inside `@angular/core` as using SystemJS style dynamic imports.
59
+ // // Removing this will cause deprecation warnings to appear.
60
+ // test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
61
+ // parser: { system: true }
62
+ // },
63
+ // // require.resolve is required only because of the monorepo structure here.
64
+ // {
65
+ // test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
66
+ // // test: /\.ts$/,
67
+ // loader: require.resolve('@ngtools/webpack')
68
+ // }
69
+ // ]
70
+ // },
71
+ // devServer: {
72
+ // historyApiFallback: true,
73
+ // port: 3002
74
+ // },
75
+ // watch: true
76
+ // };
77
+
78
+ // const assets = ['favicon.ico', 'assets/'];
79
+ // const copyWebpackPluginPatterns = assets.map(asset => {
80
+ // return {
81
+ // from: `src/${asset}`,
82
+ // to: asset.includes('.') ? '' : asset
83
+ // };
84
+ // });
85
+ // const copyWebpackPluginOptions = {
86
+ // ignore: ['.gitkeep', '**/.DS_Store', '**/Thumbs.db']
87
+ // };
88
+
89
+ // const copyWebpackPluginInstance = new CopyWebpackPlugin(copyWebpackPluginPatterns, copyWebpackPluginOptions);
90
+ // config.plugins.push(copyWebpackPluginInstance);
91
+
92
+ // module.exports = config;
@@ -0,0 +1,10 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable()
4
+ export class AppRootContext {
5
+ name: string;
6
+
7
+ setName(name: string) {
8
+ this.name = name;
9
+ }
10
+ }
@@ -0,0 +1,82 @@
1
+ import { helpers } from 'ngx-tethys/util';
2
+ const { isString, isNumber } = helpers;
3
+ const NUMBER_PREFIX = `____n____`;
4
+
5
+ const supportedStorage = window && window.localStorage;
6
+ const storageSource = window.localStorage || window.sessionStorage;
7
+
8
+ const cache = {
9
+ /**
10
+ * set item to local storage
11
+ *
12
+ * @example
13
+ * cache.set('key1', 'key1-value');
14
+ * cache.set('key1', 10);
15
+ * cache.set('key1', { id: 1, name: 'name 1'});
16
+ * cache.set('key1', 'key1-value', false);
17
+ * @param key string
18
+ * @param value string | number | object
19
+ */
20
+ set<TValue = string>(key: string, value: TValue) {
21
+ const itemValue = isString(value)
22
+ ? value
23
+ : isNumber(value)
24
+ ? `${NUMBER_PREFIX}${value}`
25
+ : JSON.stringify(value);
26
+ if (supportedStorage) {
27
+ storageSource.setItem(key, itemValue as string);
28
+ }
29
+ },
30
+ /**
31
+ * get item from local storage
32
+ *
33
+ * @example
34
+ * cache.get('key1');
35
+ * cache.get<number>('key1');
36
+ * cache.get<User>('key1');
37
+ * cache.get<User[]>('key1');
38
+ * cache.get('key1', false);
39
+ *
40
+ * @param key string
41
+ */
42
+ get<TValue = string>(key: string): TValue {
43
+ if (supportedStorage) {
44
+ const value = storageSource.getItem(key);
45
+ if (value) {
46
+ try {
47
+ const result = JSON.parse(value);
48
+ return result;
49
+ } catch (error) {
50
+ if (isString(value) && value.includes(NUMBER_PREFIX)) {
51
+ return parseInt(value.replace(NUMBER_PREFIX, ''), 10) as any;
52
+ } else {
53
+ return value as any;
54
+ }
55
+ }
56
+ } else {
57
+ return undefined;
58
+ }
59
+ } else {
60
+ return undefined;
61
+ }
62
+ },
63
+ /**
64
+ * remove key from storage
65
+ * @param key cache key
66
+ */
67
+ remove(key: string) {
68
+ if (supportedStorage) {
69
+ storageSource.removeItem(key);
70
+ }
71
+ },
72
+ /**
73
+ * clear all storage
74
+ */
75
+ clear() {
76
+ if (supportedStorage) {
77
+ storageSource.clear();
78
+ }
79
+ }
80
+ };
81
+
82
+ export { cache };
@@ -0,0 +1,13 @@
1
+ import { Overlay, OverlayContainer } from '@angular/cdk/overlay';
2
+ import { Provider } from '@angular/core';
3
+ import { PlanetOverlayContainer } from './overlay-container.service';
4
+
5
+ export * from './app-root-context';
6
+ export * from './module';
7
+ export * from './cache';
8
+ export * from './overlay-container.service';
9
+
10
+ export const OVERLAY_PROVIDER: Provider = {
11
+ provide: OverlayContainer,
12
+ useClass: PlanetOverlayContainer
13
+ };
@@ -0,0 +1,10 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { SectionCardComponent } from './section-card/section-card.component';
3
+ import { CommonModule } from '@angular/common';
4
+
5
+ @NgModule({
6
+ declarations: [SectionCardComponent],
7
+ imports: [CommonModule],
8
+ exports: [SectionCardComponent]
9
+ })
10
+ export class DemoCommonModule {}
@@ -0,0 +1,28 @@
1
+ import { OverlayContainer } from '@angular/cdk/overlay';
2
+ import { Platform } from '@angular/cdk/platform';
3
+ import { DOCUMENT } from '@angular/common';
4
+ import { Inject, Injectable } from '@angular/core';
5
+
6
+ @Injectable({ providedIn: 'root' })
7
+ export class PlanetOverlayContainer extends OverlayContainer {
8
+ constructor(@Inject(DOCUMENT) document: any, protected _platform: Platform) {
9
+ super(document, _platform);
10
+ }
11
+
12
+ private _getContainerElement(): HTMLElement {
13
+ if (!this._containerElement) {
14
+ this._containerElement = this._document.querySelector('.cdk-overlay-container');
15
+ return this._containerElement;
16
+ } else {
17
+ return this._containerElement;
18
+ }
19
+ }
20
+
21
+ getContainerElement(): HTMLElement {
22
+ if (!this._getContainerElement()) {
23
+ this._createContainer();
24
+ }
25
+
26
+ return this._containerElement;
27
+ }
28
+ }
@@ -0,0 +1,5 @@
1
+ <div class="section-card-header" *ngIf="title">{{ title }}</div>
2
+
3
+ <div class="section-card-body">
4
+ <ng-content></ng-content>
5
+ </div>
@@ -0,0 +1,15 @@
1
+ .section-card {
2
+ display: block;
3
+ position: relative;
4
+ padding: 15px;
5
+ border: 2px $gray-300 dashed;
6
+
7
+ .section-card-header {
8
+ position: absolute;
9
+ padding: 0 10px;
10
+ background: $white;
11
+ top: -10px;
12
+ left: 5px;
13
+ color: $gray-600; // $gray-500;
14
+ }
15
+ }
@@ -0,0 +1,11 @@
1
+ import { Component, HostBinding, Input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'section-card',
5
+ templateUrl: './section-card.component.html'
6
+ })
7
+ export class SectionCardComponent {
8
+ @HostBinding('class.section-card') addSectionCard = true;
9
+
10
+ @Input() title: string;
11
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ <thy-dialog-header thyTitle="a Detail from Portal"> </thy-dialog-header>
2
+ <thy-dialog-body>
3
+ <span class="resame-name">This is Micro Front-end application example.</span>
4
+ <div class="btn-pair mt-2">
5
+ <button thyButton="primary-square" (click)="ok()">Ok</button>
6
+ <button thyButton="link-secondary" (click)="close()">Cancel</button>
7
+ </div>
8
+ </thy-dialog-body>
@@ -0,0 +1,18 @@
1
+ import { Component } from '@angular/core';
2
+ import { ThyDialogRef } from 'ngx-tethys/dialog';
3
+
4
+ @Component({
5
+ selector: 'app-a-detail',
6
+ templateUrl: './a-detail.component.html'
7
+ })
8
+ export class ADetailComponent {
9
+ constructor(private dialogRef: ThyDialogRef<ADetailComponent>) {}
10
+
11
+ ok() {
12
+ this.dialogRef.close();
13
+ }
14
+
15
+ close() {
16
+ this.dialogRef.close();
17
+ }
18
+ }
@@ -0,0 +1,27 @@
1
+ <section-card title="Planet">
2
+ <code>ngx-planet</code> is a powerful and easy micro front-end library only for angular.<br />
3
+ This is live demo for planet which contains portal, app1, app2.<br /><br />
4
+ <span class="text-danger">Github Repository </span>
5
+ <a target="_blank" href="https://github.com/worktile/ngx-planet">https://github.com/worktile/ngx-planet</a>
6
+ </section-card>
7
+
8
+ <section-card class="mt-5" title="AppRootContext data, it can be change in app1">
9
+ <span class="text-desc">appRootContext.name: </span> <span class="text-danger">{{ appRootContext.name }}</span>
10
+ </section-card>
11
+
12
+ <section-card class="mt-5" title="Links to app1 and app2 from portal">
13
+ <a [routerLink]="['/app1/dashboard']" routerLinkActive="active">To App1's Dashboard</a> <br />
14
+ <a href="javascript:;" (click)="toApp2Dashboard()">To App2's Dashboard</a>
15
+ </section-card>
16
+
17
+ <section-card class="mt-5" title="Open detail by dialog, it can be opened in app1">
18
+ <button thyButton="primary-square" (click)="openADetail()">Open A Detail</button>
19
+ </section-card>
20
+
21
+ <section-card class="mt-5 portal-special" title="Portal 特有的样式">
22
+ <span class="text-desc">portal 特有样式: </span> <span class="text-danger">font-size: 20px</span>
23
+ </section-card>
24
+
25
+ <section-card class="mt-5 same-name" title="同名样式">
26
+ <span class="text-desc">同名样式: </span> <span class="text-danger">color: blue, font-size:12px</span>
27
+ </section-card>
@@ -0,0 +1,26 @@
1
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+
3
+ import { AboutComponent } from './about.component';
4
+
5
+ describe('AboutComponent', () => {
6
+ let component: AboutComponent;
7
+ let fixture: ComponentFixture<AboutComponent>;
8
+
9
+ beforeEach(
10
+ waitForAsync(() => {
11
+ TestBed.configureTestingModule({
12
+ declarations: [AboutComponent]
13
+ }).compileComponents();
14
+ })
15
+ );
16
+
17
+ beforeEach(() => {
18
+ fixture = TestBed.createComponent(AboutComponent);
19
+ component = fixture.componentInstance;
20
+ fixture.detectChanges();
21
+ });
22
+
23
+ it('should create', () => {
24
+ expect(component).toBeTruthy();
25
+ });
26
+ });
@@ -0,0 +1,26 @@
1
+ import { Component, OnInit, HostBinding } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { ThyDialog } from 'ngx-tethys/dialog';
4
+ import { ADetailComponent } from '../a-detail/a-detail.component';
5
+ import { AppRootContext } from '@demo/common';
6
+
7
+ @Component({
8
+ selector: 'app-about',
9
+ templateUrl: './about.component.html',
10
+ styleUrls: ['./about.component.scss']
11
+ })
12
+ export class AboutComponent implements OnInit {
13
+ @HostBinding(`class.thy-layout-content`) isThyLayoutContent = true;
14
+
15
+ constructor(private router: Router, private thyDialog: ThyDialog, public appRootContext: AppRootContext) {}
16
+
17
+ ngOnInit() {}
18
+
19
+ toApp2Dashboard() {
20
+ this.router.navigateByUrl(`/app2/dashboard`);
21
+ }
22
+
23
+ openADetail() {
24
+ this.thyDialog.open(ADetailComponent);
25
+ }
26
+ }
@@ -0,0 +1,57 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { Routes, RouterModule } from '@angular/router';
3
+ import { AboutComponent } from './about/about.component';
4
+ import { SettingsComponent } from './settings/settings.component';
5
+ import { EmptyComponent } from 'ngx-planet';
6
+
7
+ const routes: Routes = [
8
+ {
9
+ path: '',
10
+ redirectTo: 'about',
11
+ pathMatch: 'full'
12
+ },
13
+ {
14
+ path: 'about',
15
+ component: AboutComponent
16
+ },
17
+ {
18
+ path: 'settings',
19
+ component: SettingsComponent
20
+ },
21
+ {
22
+ path: 'app1',
23
+ component: EmptyComponent,
24
+ children: [
25
+ {
26
+ path: '**',
27
+ component: EmptyComponent
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ path: 'app2',
33
+ component: EmptyComponent,
34
+ children: [
35
+ {
36
+ path: '**',
37
+ component: EmptyComponent
38
+ }
39
+ ]
40
+ },
41
+ {
42
+ path: 'app4',
43
+ component: EmptyComponent,
44
+ children: [
45
+ {
46
+ path: '**',
47
+ component: EmptyComponent
48
+ }
49
+ ]
50
+ }
51
+ ];
52
+
53
+ @NgModule({
54
+ imports: [RouterModule.forRoot(routes, { paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' })],
55
+ exports: [RouterModule]
56
+ })
57
+ export class AppRoutingModule {}
@@ -0,0 +1,73 @@
1
+ <thy-layout>
2
+ <div class="portal">
3
+ <thy-sidebar class="app-nav">
4
+ <img class="logo" src="/assets/images/logo.svg" />
5
+ <thy-nav [thyVertical]="'true'" class="mt-2" [thyType]="'primary'">
6
+ <a
7
+ thyNavLink
8
+ thyTooltip="App1"
9
+ [routerLink]="['/app1']"
10
+ routerLinkActive="active"
11
+ thyTooltip="App1"
12
+ thyTooltipPlacement="right"
13
+ >
14
+ <thy-icon thyIconName="application"></thy-icon>
15
+ </a>
16
+ <a thyNavLink [routerLink]="['/app2']" routerLinkActive="active" thyTooltip="App2" thyTooltipPlacement="right">
17
+ <thy-icon thyIconName="app-agile"></thy-icon>
18
+ </a>
19
+ <a
20
+ thyNavLink
21
+ [routerLink]="['/about']"
22
+ routerLinkActive="active"
23
+ thyTooltip="About"
24
+ thyTooltipPlacement="right"
25
+ >
26
+ <thy-icon thyIconName="smile"></thy-icon>
27
+ </a>
28
+ <a
29
+ thyNavLink
30
+ [routerLink]="['/settings']"
31
+ routerLinkActive="active"
32
+ thyTooltip="Settings"
33
+ thyTooltipPlacement="right"
34
+ ><thy-icon thyIconName="settings"></thy-icon
35
+ ></a>
36
+ <a
37
+ thyNavLink
38
+ href="javascript:;"
39
+ [thyPopover]="more"
40
+ thyPlacement="right"
41
+ thyTooltip="More"
42
+ thyTooltipPlacement="right"
43
+ >
44
+ <thy-icon thyIconName="more"></thy-icon>
45
+ </a>
46
+
47
+ <ng-template #more>
48
+ <thy-action-menu>
49
+ <a thyActionMenuItem routerLinkActive="active" [routerLink]="['/app1/dashboard']">
50
+ <span thyActionMenuItemIcon>
51
+ <thy-icon thyIconName="house"></thy-icon>
52
+ </span>
53
+ <span thyActionMenuItemName>To App1's dashboard</span>
54
+ </a>
55
+ <a thyActionMenuItem routerLinkActive="active" [routerLink]="['/app1/users']">
56
+ <span thyActionMenuItemIcon>
57
+ <thy-icon thyIconName="user-group"></thy-icon>
58
+ </span>
59
+ <span thyActionMenuItemName>To App1's users</span>
60
+ </a>
61
+ </thy-action-menu>
62
+ </ng-template>
63
+ </thy-nav>
64
+ </thy-sidebar>
65
+ </div>
66
+ <div id="app-host-container" class="thy-layout" [ngClass]="{ hide: !loadingDone }">
67
+ <div class="portal portal-container">
68
+ <router-outlet></router-outlet>
69
+ </div>
70
+ </div>
71
+
72
+ <thy-loading class="portal" *ngIf="!loadingDone" [thyDone]="loadingDone"></thy-loading>
73
+ </thy-layout>
@@ -0,0 +1,58 @@
1
+ $app-nav-width: 70px;
2
+ $app-nav-bg-color: #48525c;
3
+
4
+ .portal-container {
5
+ display: contents;
6
+ height: 100%ß;
7
+ }
8
+ .app-nav {
9
+ width: $app-nav-width;
10
+ background: $app-nav-bg-color;
11
+ height: 100%;
12
+
13
+ .logo {
14
+ height: 50px;
15
+ margin-top: 15px;
16
+ }
17
+
18
+ &.thy-layout-sidebar {
19
+ border-right: none;
20
+ }
21
+
22
+ .nav-link {
23
+ opacity: 0.8;
24
+ min-width: $app-nav-width;
25
+ color: $white;
26
+ height: $app-nav-width;
27
+ text-align: center;
28
+ display: flex;
29
+ align-items: center;
30
+ .thy-icon {
31
+ color: $white;
32
+ font-size: $font-size-xlg;
33
+ }
34
+ &.active,
35
+ &:hover {
36
+ background: rgb(57, 65, 76);
37
+ color: $white;
38
+ .thy-icon {
39
+ color: $white;
40
+ }
41
+ }
42
+ }
43
+
44
+ // .thy-nav--vertical {
45
+ // .nav-link {
46
+ // border-left-width: 0px;
47
+ // }
48
+ // }
49
+ }
50
+
51
+ .same-name {
52
+ color: blue;
53
+ font-size: 12px;
54
+ }
55
+
56
+ .portal-special {
57
+ font-size: 20px;
58
+ }
@@ -0,0 +1,33 @@
1
+ import { TestBed, waitForAsync } from '@angular/core/testing';
2
+ import { RouterTestingModule } from '@angular/router/testing';
3
+ import { AppComponent } from './app.component';
4
+
5
+ describe('AppComponent', () => {
6
+ beforeEach(
7
+ waitForAsync(() => {
8
+ TestBed.configureTestingModule({
9
+ imports: [RouterTestingModule],
10
+ declarations: [AppComponent]
11
+ }).compileComponents();
12
+ })
13
+ );
14
+
15
+ it('should create the app', () => {
16
+ const fixture = TestBed.createComponent(AppComponent);
17
+ const app = fixture.debugElement.componentInstance;
18
+ expect(app).toBeTruthy();
19
+ });
20
+
21
+ it(`should have as title 'ngx-micro-frontend'`, () => {
22
+ const fixture = TestBed.createComponent(AppComponent);
23
+ const app = fixture.debugElement.componentInstance;
24
+ expect(app.title).toEqual('ngx-micro-frontend');
25
+ });
26
+
27
+ it('should render title in a h1 tag', () => {
28
+ const fixture = TestBed.createComponent(AppComponent);
29
+ fixture.detectChanges();
30
+ const compiled = fixture.debugElement.nativeElement;
31
+ expect(compiled.querySelector('h1').textContent).toContain('Welcome to ngx-micro-frontend!');
32
+ });
33
+ });