@worktile/planet 16.0.0 → 17.0.0-next.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 (45) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +62 -37
  3. package/application/ng-planet-application-ref.d.ts +48 -0
  4. package/application/ng-planet-application-ref.d.ts.map +1 -0
  5. package/application/planet-application-ref.d.ts +3 -27
  6. package/application/planet-application-ref.d.ts.map +1 -1
  7. package/assets-loader.d.ts +2 -3
  8. package/assets-loader.d.ts.map +1 -1
  9. package/component/planet-component-loader.d.ts.map +1 -1
  10. package/esm2022/application/ng-planet-application-ref.mjs +108 -0
  11. package/esm2022/application/planet-application-loader.mjs +5 -5
  12. package/esm2022/application/planet-application-ref.mjs +2 -94
  13. package/esm2022/application/planet-application.service.mjs +5 -5
  14. package/esm2022/assets-loader.mjs +46 -12
  15. package/esm2022/component/planet-component-loader.mjs +19 -18
  16. package/esm2022/component/planet-component-outlet.mjs +6 -6
  17. package/esm2022/debug.mjs +1 -1
  18. package/esm2022/empty/empty.component.mjs +3 -3
  19. package/esm2022/global-event-dispatcher.mjs +5 -5
  20. package/esm2022/global-planet.mjs +13 -3
  21. package/esm2022/helpers.mjs +83 -17
  22. package/esm2022/module.mjs +4 -4
  23. package/esm2022/planet.class.mjs +1 -1
  24. package/esm2022/planet.mjs +6 -6
  25. package/esm2022/public-api.mjs +1 -2
  26. package/esm2022/router/route-redirect.mjs +5 -5
  27. package/esm2022/sandbox/index.mjs +1 -1
  28. package/esm2022/sandbox/proxy/patches/eventListener.mjs +2 -2
  29. package/esm2022/sandbox/proxy/proxies/common.mjs +1 -1
  30. package/esm2022/sandbox/proxy/proxies/document.mjs +1 -1
  31. package/esm2022/sandbox/proxy/proxies/window.mjs +1 -1
  32. package/esm2022/sandbox/proxy/proxy-sandbox.mjs +1 -1
  33. package/esm2022/sandbox/snapshot/snapshot-sandbox.mjs +1 -1
  34. package/fesm2022/worktile-planet.mjs +221 -96
  35. package/fesm2022/worktile-planet.mjs.map +1 -1
  36. package/global-planet.d.ts +4 -2
  37. package/global-planet.d.ts.map +1 -1
  38. package/helpers.d.ts +5 -2
  39. package/helpers.d.ts.map +1 -1
  40. package/package.json +3 -3
  41. package/planet.class.d.ts +84 -4
  42. package/planet.class.d.ts.map +1 -1
  43. package/sandbox/proxy/patches/eventListener.d.ts.map +1 -1
  44. package/sandbox/proxy/proxy-sandbox.d.ts.map +1 -1
  45. package/sandbox/snapshot/snapshot-sandbox.d.ts.map +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, NgZone, Inject, Optional, Component, ChangeDetectionStrategy, Injector, createComponent, reflectComponentType, EventEmitter, Directive, Input, Output, inject, NgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, NgZone, NgModuleRef, Inject, Optional, Component, ChangeDetectionStrategy, Injector, createComponent, reflectComponentType, EventEmitter, Directive, Input, Output, inject, NgModule } from '@angular/core';
3
3
  import * as i3 from '@angular/router';
4
4
  import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
5
5
  import * as i1 from '@angular/common/http';
@@ -68,8 +68,8 @@ function isFunction(value) {
68
68
  const type = typeof value;
69
69
  return !!value && type === 'function';
70
70
  }
71
- function isObject(val) {
72
- return val && typeof val === 'object';
71
+ function isObject(value) {
72
+ return value && typeof value === 'object';
73
73
  }
74
74
  /**
75
75
  * Get file name from path
@@ -86,6 +86,15 @@ function getResourceFileName(path) {
86
86
  return path;
87
87
  }
88
88
  }
89
+ function getExtName(name) {
90
+ const lastDotIndex = name.lastIndexOf('.');
91
+ if (lastDotIndex >= 0) {
92
+ return name.slice(lastDotIndex + 1);
93
+ }
94
+ else {
95
+ return '';
96
+ }
97
+ }
89
98
  /**
90
99
  * Build resource path by manifest
91
100
  * if manifest is { "main.js": "main.h2sh23abee.js"}
@@ -103,34 +112,91 @@ function buildResourceFilePath(resourceFilePath, manifestResult) {
103
112
  return resourceFilePath;
104
113
  }
105
114
  }
115
+ function buildFullPath(path, basePath) {
116
+ if (basePath) {
117
+ if (path.startsWith(basePath)) {
118
+ return path;
119
+ }
120
+ else {
121
+ return `${basePath}${path}`;
122
+ }
123
+ }
124
+ return path;
125
+ }
126
+ function getDefinedAssets(app) {
127
+ if (app.entry) {
128
+ return {
129
+ scripts: isObject(app.entry) ? app.entry.scripts : undefined,
130
+ styles: isObject(app.entry) ? app.entry.styles : undefined
131
+ };
132
+ }
133
+ return {
134
+ scripts: app.scripts,
135
+ styles: app.styles
136
+ };
137
+ }
138
+ function getAssetsBasePath(app) {
139
+ let basePath;
140
+ if (app.entry) {
141
+ if (isObject(app.entry)) {
142
+ basePath = app.entry.basePath;
143
+ }
144
+ else {
145
+ const lastDotIndex = app.entry.lastIndexOf('/');
146
+ basePath = lastDotIndex > 0 ? app.entry.slice(0, lastDotIndex + 1) : undefined;
147
+ }
148
+ }
149
+ return basePath || app.resourcePathPrefix;
150
+ }
106
151
  /**
107
152
  * Get static resource full path
108
153
  * @param app PlanetApplication
109
154
  * @param manifestResult manifest
110
155
  */
111
- function getScriptsAndStylesFullPaths(app, manifestResult) {
112
- let scripts = app.scripts || [];
113
- let styles = app.styles || [];
156
+ function getScriptsAndStylesFullPaths(app, basePath, manifestResult) {
157
+ let { scripts, styles } = getDefinedAssets(app);
114
158
  // combine resource path by manifest
115
159
  if (manifestResult) {
116
- scripts = scripts.map(script => {
117
- return buildResourceFilePath(script, manifestResult);
118
- });
119
- styles = styles.map(style => {
120
- return buildResourceFilePath(style, manifestResult);
121
- });
160
+ if (scripts) {
161
+ scripts = scripts.map(script => {
162
+ return buildResourceFilePath(script, manifestResult);
163
+ });
164
+ }
165
+ else {
166
+ scripts = Object.keys(manifestResult)
167
+ .filter(key => {
168
+ return getExtName(key) === 'js';
169
+ })
170
+ .map(key => {
171
+ return manifestResult[key];
172
+ });
173
+ }
174
+ if (styles) {
175
+ styles = styles.map(style => {
176
+ return buildResourceFilePath(style, manifestResult);
177
+ });
178
+ }
179
+ else {
180
+ styles = Object.keys(manifestResult)
181
+ .filter(key => {
182
+ return getExtName(key) === 'css';
183
+ })
184
+ .map(key => {
185
+ return manifestResult[key];
186
+ });
187
+ }
122
188
  }
123
- if (app.resourcePathPrefix) {
189
+ if (basePath) {
124
190
  scripts = scripts.map(script => {
125
- return `${app.resourcePathPrefix}${script}`;
191
+ return buildFullPath(script, basePath);
126
192
  });
127
193
  styles = styles.map(style => {
128
- return `${app.resourcePathPrefix}${style}`;
194
+ return buildFullPath(style, basePath);
129
195
  });
130
196
  }
131
197
  return {
132
- scripts: scripts,
133
- styles: styles
198
+ scripts: scripts || [],
199
+ styles: styles || []
134
200
  };
135
201
  }
136
202
 
@@ -453,7 +519,7 @@ function eventListenerPatch(sandbox) {
453
519
  removeEventListener: removeEventListener.bind(window)
454
520
  },
455
521
  init() {
456
- const fakeDocument = sandbox.global.document;
522
+ const fakeDocument = sandbox.global['document'];
457
523
  if (fakeDocument) {
458
524
  fakeDocument.addEventListener = addEventListener.bind(document);
459
525
  fakeDocument.removeEventListener = removeEventListener.bind(document);
@@ -784,6 +850,8 @@ function getSandboxInstance() {
784
850
  return window[SANDBOX_INSTANCE];
785
851
  }
786
852
 
853
+ const STYLE_LINK_OR_SCRIPT_REG = /<[script|link].*?">/gi;
854
+ const LINK_OR_SRC_REG = /(src|href)=["'](.*?)["']/i;
787
855
  class AssetsLoader {
788
856
  constructor(http) {
789
857
  this.http = http;
@@ -957,10 +1025,38 @@ class AssetsLoader {
957
1025
  loadScriptsAndStyles(scripts = [], styles = [], options) {
958
1026
  return forkJoin([this.loadScripts(scripts, options), this.loadStyles(styles)]);
959
1027
  }
1028
+ parseManifestFromHTML(html) {
1029
+ const result = {};
1030
+ const matchResult = html.match(STYLE_LINK_OR_SCRIPT_REG);
1031
+ matchResult.forEach(item => {
1032
+ const linkOrSrcResult = item.match(LINK_OR_SRC_REG);
1033
+ if (linkOrSrcResult[2]) {
1034
+ const src = linkOrSrcResult[2];
1035
+ const hashName = getResourceFileName(src);
1036
+ let barSplitIndex = hashName.indexOf('-');
1037
+ let dotSplitIndex = hashName.indexOf('.');
1038
+ const splitIndex = barSplitIndex > -1 ? barSplitIndex : dotSplitIndex;
1039
+ if (splitIndex > -1) {
1040
+ const name = hashName.slice(0, splitIndex);
1041
+ const ext = getExtName(hashName);
1042
+ result[ext ? `${name}.${ext}` : name] = src;
1043
+ }
1044
+ }
1045
+ });
1046
+ return result;
1047
+ }
960
1048
  loadAppAssets(app) {
961
- if (app.manifest) {
962
- return this.loadManifest(`${app.manifest}?t=${new Date().getTime()}`).pipe(switchMap(manifestResult => {
963
- const { scripts, styles } = getScriptsAndStylesFullPaths(app, manifestResult);
1049
+ const basePath = getAssetsBasePath(app);
1050
+ const manifest = app.entry ? (isObject(app.entry) ? app.entry.manifest : app.entry) : app.manifest;
1051
+ if (manifest) {
1052
+ const manifestExt = getExtName(manifest);
1053
+ const isHtml = manifestExt === 'html';
1054
+ const responseType = isHtml ? 'text' : 'json';
1055
+ return this.loadManifest(`${manifest}?t=${new Date().getTime()}`, responseType).pipe(switchMap(manifestResult => {
1056
+ if (responseType === 'text') {
1057
+ manifestResult = this.parseManifestFromHTML(manifestResult);
1058
+ }
1059
+ const { scripts, styles } = getScriptsAndStylesFullPaths(app, basePath, manifestResult);
964
1060
  return this.loadScriptsAndStyles(scripts, styles, {
965
1061
  app: app.name,
966
1062
  sandbox: app.sandbox,
@@ -969,7 +1065,7 @@ class AssetsLoader {
969
1065
  }));
970
1066
  }
971
1067
  else {
972
- const { scripts, styles } = getScriptsAndStylesFullPaths(app);
1068
+ const { scripts, styles } = getScriptsAndStylesFullPaths(app, basePath);
973
1069
  return this.loadScriptsAndStyles(scripts, styles, {
974
1070
  app: app.name,
975
1071
  sandbox: app.sandbox,
@@ -977,34 +1073,38 @@ class AssetsLoader {
977
1073
  });
978
1074
  }
979
1075
  }
980
- loadManifest(url) {
981
- return this.http.get(url).pipe(map((response) => {
1076
+ loadManifest(url, responseType = 'json') {
1077
+ return this.http
1078
+ .get(url, {
1079
+ responseType: responseType
1080
+ })
1081
+ .pipe(map((response) => {
982
1082
  return response;
983
1083
  }));
984
1084
  }
985
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AssetsLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
986
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AssetsLoader, providedIn: 'root' }); }
1085
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: AssetsLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
1086
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: AssetsLoader, providedIn: 'root' }); }
987
1087
  }
988
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AssetsLoader, decorators: [{
1088
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: AssetsLoader, decorators: [{
989
1089
  type: Injectable,
990
1090
  args: [{
991
1091
  providedIn: 'root'
992
1092
  }]
993
- }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
1093
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
994
1094
 
995
- class PlanetApplicationRef {
1095
+ class NgPlanetApplicationRef {
996
1096
  get selector() {
997
1097
  return this.innerSelector;
998
1098
  }
999
- get bootstrapped() {
1000
- return !!this.appModuleRef;
1001
- }
1002
1099
  get ngZone() {
1003
- return this.appModuleRef?.injector.get(NgZone);
1100
+ return (this.injector || this.appModuleRef?.injector)?.get(NgZone);
1004
1101
  }
1005
1102
  get sandbox() {
1006
1103
  return getSandboxInstance();
1007
1104
  }
1105
+ get bootstrapped() {
1106
+ return !!(this.appModuleRef || this.appRef);
1107
+ }
1008
1108
  constructor(name, options) {
1009
1109
  this.name = name;
1010
1110
  if (options) {
@@ -1014,14 +1114,14 @@ class PlanetApplicationRef {
1014
1114
  }
1015
1115
  // This is a hack, since NgZone doesn't allow you to configure the property that identifies your zone.
1016
1116
  // See https://github.com/PlaceMe-SAS/single-spa-angular-cli/issues/33,
1017
- NgZone.isInAngularZone = () => {
1018
- // @ts-ignore
1019
- return window.Zone.current._properties[`ngx-planet-${name}`] === true;
1020
- };
1117
+ // NgZone.isInAngularZone = () => {
1118
+ // // @ts-ignore
1119
+ // return window.Zone.current._properties[`ngx-planet-${name}`] === true;
1120
+ // };
1021
1121
  }
1022
1122
  // 子应用路由变化后同步修改 portal 的 Route
1023
1123
  syncPortalRouteWhenNavigationEnd() {
1024
- const router = this.appModuleRef?.injector.get(Router);
1124
+ const router = (this.injector || this.appModuleRef?.injector)?.get(Router);
1025
1125
  if (router) {
1026
1126
  router.events.subscribe(event => {
1027
1127
  if (event instanceof NavigationEnd) {
@@ -1029,7 +1129,9 @@ class PlanetApplicationRef {
1029
1129
  .asObservable()
1030
1130
  .pipe(take(1))
1031
1131
  .subscribe(() => {
1032
- this.portalApp.router.navigateByUrl(event.url);
1132
+ this.portalApp.ngZone.run(() => {
1133
+ this.portalApp.router.navigateByUrl(event.url);
1134
+ });
1033
1135
  });
1034
1136
  }
1035
1137
  });
@@ -1041,14 +1143,23 @@ class PlanetApplicationRef {
1041
1143
  }
1042
1144
  this.portalApp = app;
1043
1145
  return from(this.appModuleBootstrap(app).then(appModuleRef => {
1044
- this.appModuleRef = appModuleRef;
1045
- this.appModuleRef.instance.appName = this.name;
1146
+ if (appModuleRef['instance']) {
1147
+ this.appModuleRef = appModuleRef;
1148
+ this.appModuleRef.instance.appName = this.name;
1149
+ this.injector = this.appModuleRef.injector;
1150
+ }
1151
+ else {
1152
+ this.appRef = appModuleRef;
1153
+ this.injector = this.appRef.injector;
1154
+ const moduleRef = this.appRef.injector.get(NgModuleRef);
1155
+ moduleRef.instance = { appName: this.name };
1156
+ }
1046
1157
  this.syncPortalRouteWhenNavigationEnd();
1047
1158
  return this;
1048
1159
  }));
1049
1160
  }
1050
1161
  getRouter() {
1051
- return this.appModuleRef?.injector.get(Router);
1162
+ return (this.injector || this.appModuleRef?.injector)?.get(Router);
1052
1163
  }
1053
1164
  getCurrentRouterStateUrl() {
1054
1165
  return this.getRouter()?.routerState.snapshot.url;
@@ -1066,16 +1177,19 @@ class PlanetApplicationRef {
1066
1177
  this.componentFactory = componentFactory;
1067
1178
  }
1068
1179
  destroy() {
1069
- if (this.appModuleRef) {
1070
- const router = this.appModuleRef.injector.get(Router);
1180
+ if (this.appModuleRef || this.appRef) {
1181
+ const router = (this.injector || this.appModuleRef?.injector)?.get(Router);
1071
1182
  if (router) {
1072
1183
  router.dispose();
1073
1184
  }
1074
1185
  if (this.sandbox) {
1075
1186
  this.sandbox.destroy();
1076
1187
  }
1077
- this.appModuleRef.destroy();
1188
+ this.appModuleRef?.destroy();
1078
1189
  this.appModuleRef = undefined;
1190
+ this.appRef?.destroy();
1191
+ this.appRef = undefined;
1192
+ this.injector = undefined;
1079
1193
  }
1080
1194
  }
1081
1195
  }
@@ -1093,7 +1207,7 @@ function defineApplication(name, options) {
1093
1207
  bootstrap: options
1094
1208
  };
1095
1209
  }
1096
- const appRef = new PlanetApplicationRef(name, options);
1210
+ const appRef = new NgPlanetApplicationRef(name, options);
1097
1211
  globalPlanet.apps[name] = appRef;
1098
1212
  }
1099
1213
  function getPlanetApplicationRef(appName) {
@@ -1104,6 +1218,16 @@ function getPlanetApplicationRef(appName) {
1104
1218
  return null;
1105
1219
  }
1106
1220
  }
1221
+ function getBootstrappedPlanetApplicationRef(appName) {
1222
+ const plantAppRef = getPlanetApplicationRef(appName);
1223
+ if (plantAppRef) {
1224
+ // 兼容之前的版本,之前是通过 appModuleRef 来判断是否启用的
1225
+ if (plantAppRef.bootstrapped || plantAppRef['appModuleRef']) {
1226
+ return plantAppRef;
1227
+ }
1228
+ }
1229
+ return null;
1230
+ }
1107
1231
  function setPortalApplicationData(data) {
1108
1232
  if (globalPlanet.portalApplication) {
1109
1233
  globalPlanet.portalApplication.data = data;
@@ -1197,15 +1321,15 @@ class PlanetApplicationService {
1197
1321
  getApps() {
1198
1322
  return this.apps;
1199
1323
  }
1200
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetApplicationService, deps: [{ token: i1.HttpClient }, { token: AssetsLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
1201
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetApplicationService, providedIn: 'root' }); }
1324
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetApplicationService, deps: [{ token: i1.HttpClient }, { token: AssetsLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
1325
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetApplicationService, providedIn: 'root' }); }
1202
1326
  }
1203
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetApplicationService, decorators: [{
1327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetApplicationService, decorators: [{
1204
1328
  type: Injectable,
1205
1329
  args: [{
1206
1330
  providedIn: 'root'
1207
1331
  }]
1208
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: AssetsLoader }]; } });
1332
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: AssetsLoader }] });
1209
1333
 
1210
1334
  class PlanetPortalApplication {
1211
1335
  navigateByUrl(url, extras) {
@@ -1279,15 +1403,15 @@ class GlobalEventDispatcher {
1279
1403
  getSubscriptionCount() {
1280
1404
  return this.subscriptionCount;
1281
1405
  }
1282
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GlobalEventDispatcher, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
1283
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GlobalEventDispatcher, providedIn: 'root' }); }
1406
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: GlobalEventDispatcher, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
1407
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: GlobalEventDispatcher, providedIn: 'root' }); }
1284
1408
  }
1285
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: GlobalEventDispatcher, decorators: [{
1409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: GlobalEventDispatcher, decorators: [{
1286
1410
  type: Injectable,
1287
1411
  args: [{
1288
1412
  providedIn: 'root'
1289
1413
  }]
1290
- }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
1414
+ }], ctorParameters: () => [{ type: i0.NgZone }] });
1291
1415
 
1292
1416
  /**
1293
1417
  * Debug factory for debug module
@@ -1749,15 +1873,15 @@ class PlanetApplicationLoader {
1749
1873
  preload(app, immediate) {
1750
1874
  return this.preloadInternal(app, immediate);
1751
1875
  }
1752
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetApplicationLoader, deps: [{ token: AssetsLoader }, { token: PlanetApplicationService }, { token: i0.NgZone }, { token: i3.Router }, { token: i0.Injector }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
1753
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetApplicationLoader, providedIn: 'root' }); }
1876
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetApplicationLoader, deps: [{ token: AssetsLoader }, { token: PlanetApplicationService }, { token: i0.NgZone }, { token: i3.Router }, { token: i0.Injector }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
1877
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetApplicationLoader, providedIn: 'root' }); }
1754
1878
  }
1755
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetApplicationLoader, decorators: [{
1879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetApplicationLoader, decorators: [{
1756
1880
  type: Injectable,
1757
1881
  args: [{
1758
1882
  providedIn: 'root'
1759
1883
  }]
1760
- }], ctorParameters: function () { return [{ type: AssetsLoader }, { type: PlanetApplicationService }, { type: i0.NgZone }, { type: i3.Router }, { type: i0.Injector }, { type: i0.ApplicationRef }]; } });
1884
+ }], ctorParameters: () => [{ type: AssetsLoader }, { type: PlanetApplicationService }, { type: i0.NgZone }, { type: i3.Router }, { type: i0.Injector }, { type: i0.ApplicationRef }] });
1761
1885
 
1762
1886
  class Planet {
1763
1887
  get planetApplicationLoader() {
@@ -1825,26 +1949,26 @@ class Planet {
1825
1949
  stop() {
1826
1950
  this.subscription?.unsubscribe();
1827
1951
  }
1828
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Planet, deps: [{ token: i0.Injector }, { token: i3.Router }, { token: PLANET_APPLICATIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1829
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Planet, providedIn: 'root' }); }
1952
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: Planet, deps: [{ token: i0.Injector }, { token: i3.Router }, { token: PLANET_APPLICATIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1953
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: Planet, providedIn: 'root' }); }
1830
1954
  }
1831
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: Planet, decorators: [{
1955
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: Planet, decorators: [{
1832
1956
  type: Injectable,
1833
1957
  args: [{
1834
1958
  providedIn: 'root'
1835
1959
  }]
1836
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i3.Router }, { type: undefined, decorators: [{
1960
+ }], ctorParameters: () => [{ type: i0.Injector }, { type: i3.Router }, { type: undefined, decorators: [{
1837
1961
  type: Inject,
1838
1962
  args: [PLANET_APPLICATIONS]
1839
1963
  }, {
1840
1964
  type: Optional
1841
- }] }]; } });
1965
+ }] }] });
1842
1966
 
1843
1967
  class EmptyComponent {
1844
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: EmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1845
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: EmptyComponent, isStandalone: true, selector: "empty-component", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1968
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: EmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1969
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.3", type: EmptyComponent, isStandalone: true, selector: "empty-component", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1846
1970
  }
1847
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: EmptyComponent, decorators: [{
1971
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: EmptyComponent, decorators: [{
1848
1972
  type: Component,
1849
1973
  args: [{
1850
1974
  // eslint-disable-next-line @angular-eslint/component-selector
@@ -1876,17 +2000,18 @@ class PlanetComponentLoader {
1876
2000
  this.document = document;
1877
2001
  }
1878
2002
  getPlantAppRef(name) {
1879
- if (globalPlanet.apps[name] && globalPlanet.apps[name].appModuleRef) {
1880
- return of(globalPlanet.apps[name]);
2003
+ const plantAppRef = getBootstrappedPlanetApplicationRef(name);
2004
+ if (plantAppRef) {
2005
+ return of(plantAppRef);
1881
2006
  }
1882
2007
  else {
1883
2008
  const app = this.applicationService.getAppByName(name);
1884
2009
  return this.applicationLoader.preload(app, true).pipe(map(() => {
1885
- return globalPlanet.apps[name];
2010
+ return getPlanetApplicationRef(name);
1886
2011
  }));
1887
2012
  }
1888
2013
  }
1889
- createInjector(appModuleRef, componentRef) {
2014
+ createInjector(parentInjector, componentRef) {
1890
2015
  return Injector.create({
1891
2016
  providers: [
1892
2017
  {
@@ -1894,7 +2019,7 @@ class PlanetComponentLoader {
1894
2019
  useValue: componentRef
1895
2020
  }
1896
2021
  ],
1897
- parent: appModuleRef.injector
2022
+ parent: parentInjector
1898
2023
  });
1899
2024
  }
1900
2025
  getContainerElement(config) {
@@ -1928,13 +2053,13 @@ class PlanetComponentLoader {
1928
2053
  container.appendChild(componentRootNode);
1929
2054
  }
1930
2055
  }
1931
- attachComponent(component, appModuleRef, config) {
2056
+ attachComponent(component, environmentInjector, config) {
1932
2057
  const plantComponentRef = new PlanetComponentRef();
1933
2058
  const appRef = this.applicationRef;
1934
- const injector = this.createInjector(appModuleRef, plantComponentRef);
2059
+ const injector = this.createInjector(environmentInjector, plantComponentRef);
1935
2060
  const container = this.getContainerElement(config);
1936
2061
  const componentRef = createComponent(component, {
1937
- environmentInjector: appModuleRef.injector,
2062
+ environmentInjector: environmentInjector,
1938
2063
  elementInjector: injector
1939
2064
  });
1940
2065
  appRef.attachView(componentRef.hostView);
@@ -1961,7 +2086,7 @@ class PlanetComponentLoader {
1961
2086
  }
1962
2087
  registerComponentFactory(componentOrComponents) {
1963
2088
  const app = this.ngModuleRef.instance.appName;
1964
- this.getPlantAppRef(app).subscribe(appRef => {
2089
+ this.getPlantAppRef(app).subscribe((appRef) => {
1965
2090
  appRef.registerComponentFactory((componentName, config) => {
1966
2091
  const components = coerceArray(componentOrComponents);
1967
2092
  const planetComponent = components.find(item => {
@@ -1971,7 +2096,7 @@ class PlanetComponentLoader {
1971
2096
  });
1972
2097
  if (planetComponent) {
1973
2098
  return this.ngZone.run(() => {
1974
- const componentRef = this.attachComponent(isComponentType(planetComponent) ? planetComponent : planetComponent.component, appRef.appModuleRef, config);
2099
+ const componentRef = this.attachComponent(isComponentType(planetComponent) ? planetComponent : planetComponent.component, appRef.appModuleRef.injector, config);
1975
2100
  return componentRef;
1976
2101
  });
1977
2102
  }
@@ -1987,7 +2112,7 @@ class PlanetComponentLoader {
1987
2112
  });
1988
2113
  }
1989
2114
  load(app, componentName, config) {
1990
- const result = this.getPlantAppRef(app).pipe(delayWhen(appRef => {
2115
+ const result = this.getPlantAppRef(app).pipe(delayWhen((appRef) => {
1991
2116
  if (appRef.getComponentFactory()) {
1992
2117
  return of('');
1993
2118
  }
@@ -2007,18 +2132,18 @@ class PlanetComponentLoader {
2007
2132
  result.subscribe();
2008
2133
  return result;
2009
2134
  }
2010
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetComponentLoader, deps: [{ token: i0.ApplicationRef }, { token: i0.NgModuleRef }, { token: i0.NgZone }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
2011
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetComponentLoader, providedIn: 'root' }); }
2135
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetComponentLoader, deps: [{ token: i0.ApplicationRef }, { token: i0.NgModuleRef }, { token: i0.NgZone }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
2136
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetComponentLoader, providedIn: 'root' }); }
2012
2137
  }
2013
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetComponentLoader, decorators: [{
2138
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetComponentLoader, decorators: [{
2014
2139
  type: Injectable,
2015
2140
  args: [{
2016
2141
  providedIn: 'root'
2017
2142
  }]
2018
- }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i0.NgModuleRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
2143
+ }], ctorParameters: () => [{ type: i0.ApplicationRef }, { type: i0.NgModuleRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
2019
2144
  type: Inject,
2020
2145
  args: [DOCUMENT]
2021
- }] }]; } });
2146
+ }] }] });
2022
2147
 
2023
2148
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
2024
2149
  class PlanetComponentOutlet {
@@ -2030,7 +2155,7 @@ class PlanetComponentOutlet {
2030
2155
  this.destroyed$ = new Subject();
2031
2156
  }
2032
2157
  ngOnChanges(changes) {
2033
- if (this.planetComponentOutlet && !changes.planetComponentOutlet.isFirstChange()) {
2158
+ if (this.planetComponentOutlet && !changes['planetComponentOutlet'].isFirstChange()) {
2034
2159
  this.loadComponent();
2035
2160
  }
2036
2161
  }
@@ -2064,16 +2189,16 @@ class PlanetComponentOutlet {
2064
2189
  this.componentRef?.dispose();
2065
2190
  this.destroyed$.next();
2066
2191
  }
2067
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetComponentOutlet, deps: [{ token: i0.ElementRef }, { token: PlanetComponentLoader }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
2068
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.6", type: PlanetComponentOutlet, isStandalone: true, selector: "[planetComponentOutlet]", inputs: { planetComponentOutlet: "planetComponentOutlet", planetComponentOutletApp: "planetComponentOutletApp", planetComponentOutletInitialState: "planetComponentOutletInitialState" }, outputs: { planetComponentLoaded: "planetComponentLoaded" }, usesOnChanges: true, ngImport: i0 }); }
2192
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetComponentOutlet, deps: [{ token: i0.ElementRef }, { token: PlanetComponentLoader }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
2193
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.3", type: PlanetComponentOutlet, isStandalone: true, selector: "[planetComponentOutlet]", inputs: { planetComponentOutlet: "planetComponentOutlet", planetComponentOutletApp: "planetComponentOutletApp", planetComponentOutletInitialState: "planetComponentOutletInitialState" }, outputs: { planetComponentLoaded: "planetComponentLoaded" }, usesOnChanges: true, ngImport: i0 }); }
2069
2194
  }
2070
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PlanetComponentOutlet, decorators: [{
2195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: PlanetComponentOutlet, decorators: [{
2071
2196
  type: Directive,
2072
2197
  args: [{
2073
2198
  selector: '[planetComponentOutlet]',
2074
2199
  standalone: true
2075
2200
  }]
2076
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: PlanetComponentLoader }, { type: i0.NgZone }]; }, propDecorators: { planetComponentOutlet: [{
2201
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: PlanetComponentLoader }, { type: i0.NgZone }], propDecorators: { planetComponentOutlet: [{
2077
2202
  type: Input
2078
2203
  }], planetComponentOutletApp: [{
2079
2204
  type: Input
@@ -2087,7 +2212,7 @@ class RouteRedirect {
2087
2212
  constructor(redirectTo) {
2088
2213
  this.activatedRoute = inject(ActivatedRoute);
2089
2214
  this.router = inject(Router);
2090
- const finalRedirectTo = redirectTo || this.activatedRoute.snapshot.data.redirectTo;
2215
+ const finalRedirectTo = redirectTo || this.activatedRoute.snapshot.data['redirectTo'];
2091
2216
  if (finalRedirectTo) {
2092
2217
  const activatedRouteUrl = this.activatedRoute.pathFromRoot
2093
2218
  .filter(route => {
@@ -2122,10 +2247,10 @@ class RedirectToRouteComponent {
2122
2247
  constructor() {
2123
2248
  this.routeRedirect = routeRedirect();
2124
2249
  }
2125
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: RedirectToRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2126
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: RedirectToRouteComponent, isStandalone: true, selector: "planet-redirect-to-route", ngImport: i0, template: '', isInline: true }); }
2250
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: RedirectToRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2251
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.3", type: RedirectToRouteComponent, isStandalone: true, selector: "planet-redirect-to-route", ngImport: i0, template: '', isInline: true }); }
2127
2252
  }
2128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: RedirectToRouteComponent, decorators: [{
2253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: RedirectToRouteComponent, decorators: [{
2129
2254
  type: Component,
2130
2255
  args: [{
2131
2256
  selector: 'planet-redirect-to-route',
@@ -2155,11 +2280,11 @@ class NgxPlanetModule {
2155
2280
  ]
2156
2281
  };
2157
2282
  }
2158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: NgxPlanetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2159
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, PlanetComponentOutlet, EmptyComponent, RedirectToRouteComponent], exports: [HttpClientModule, EmptyComponent, PlanetComponentOutlet] }); }
2160
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, HttpClientModule] }); }
2283
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: NgxPlanetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2284
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.3", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, PlanetComponentOutlet, EmptyComponent, RedirectToRouteComponent], exports: [HttpClientModule, EmptyComponent, PlanetComponentOutlet] }); }
2285
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, HttpClientModule] }); }
2161
2286
  }
2162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: NgxPlanetModule, decorators: [{
2287
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.3", ngImport: i0, type: NgxPlanetModule, decorators: [{
2163
2288
  type: NgModule,
2164
2289
  args: [{
2165
2290
  declarations: [],
@@ -2184,5 +2309,5 @@ class PlantComponentConfig {
2184
2309
  * Generated bundle index. Do not edit.
2185
2310
  */
2186
2311
 
2187
- export { ApplicationStatus, AssetsLoader, EmptyComponent, GlobalEventDispatcher, NgxPlanetModule, PLANET_APPLICATIONS, Planet, PlanetApplicationLoader, PlanetApplicationRef, PlanetApplicationService, PlanetComponentLoader, PlanetComponentOutlet, PlanetComponentRef, PlanetPortalApplication, PlantComponentConfig, RedirectToRouteComponent, SwitchModes, defineApplication, getPlanetApplicationRef, getPortalApplicationData, redirectToRoute, routeRedirect };
2312
+ export { ApplicationStatus, AssetsLoader, EmptyComponent, GlobalEventDispatcher, NgxPlanetModule, PLANET_APPLICATIONS, Planet, PlanetApplicationLoader, PlanetApplicationService, PlanetComponentLoader, PlanetComponentOutlet, PlanetComponentRef, PlanetPortalApplication, PlantComponentConfig, RedirectToRouteComponent, SwitchModes, defineApplication, getPlanetApplicationRef, getPortalApplicationData, redirectToRoute, routeRedirect };
2188
2313
  //# sourceMappingURL=worktile-planet.mjs.map