sample-cross-fx 1.2.0-beta.5863 → 1.2.0-beta.5867

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.
package/app/index.d.ts CHANGED
@@ -606,15 +606,17 @@ export interface NgModuleDefiner {
606
606
  * Defines the module to use when bootstrapping the Angular pilet.
607
607
  * @param ngModule The module to use for running Angular.
608
608
  * @param opts The options to pass when bootstrapping.
609
+ * @param flags The flags to use when dealing with the module.
609
610
  */
610
- <T>(module: AngularCore.Type<T>, opts?: NgOptions): void;
611
+ <T>(module: AngularCore.Type<T>, opts?: NgOptions, flags?: NgModuleFlags): void;
611
612
  /**
612
613
  * Defines the module to lazy load for bootstrapping the Angular pilet.
613
614
  * @param getModule The module lazy loader to use for running Angular.
614
615
  * @param opts The options to pass when bootstrapping.
616
+ * @param flags The flags to use when dealing with the module.
615
617
  * @returns The module ID to be used to reference components.
616
618
  */
617
- <T>(getModule: LazyType<T>, opts?: NgOptions): NgComponentLoader;
619
+ <T>(getModule: LazyType<T>, opts?: NgOptions, flags?: NgModuleFlags): NgComponentLoader;
618
620
  }
619
621
 
620
622
  export interface NgComponent {
@@ -997,6 +999,13 @@ export interface BaseExtensionSlotProps<TName, TParams> {
997
999
  */
998
1000
  export type NgOptions = Parameters<AngularCore.PlatformRef["bootstrapModule"]>[1];
999
1001
 
1002
+ export interface NgModuleFlags {
1003
+ /**
1004
+ * If set to true prevents the module from being disposed.
1005
+ */
1006
+ keepAlive?: boolean;
1007
+ }
1008
+
1000
1009
  /**
1001
1010
  * The lazy loading interface for retrieving Angular components.
1002
1011
  */
@@ -1026,6 +1035,7 @@ export interface NgLazyType {
1026
1035
  default: AngularCore.Type<any>;
1027
1036
  }>;
1028
1037
  opts: NgOptions;
1038
+ flags: NgModuleFlags;
1029
1039
  state: any;
1030
1040
  }
1031
1041
 
@@ -55732,6 +55732,9 @@ let RoutingService = class RoutingService {
55732
55732
  };
55733
55733
  const skipIds = [];
55734
55734
  const nav = this.context.navigation;
55735
+ const queueNavigation = url => {
55736
+ window.requestAnimationFrame(() => nav.push(url));
55737
+ };
55735
55738
  this.dispose = nav.listen(({
55736
55739
  location
55737
55740
  }) => {
@@ -55750,7 +55753,7 @@ let RoutingService = class RoutingService {
55750
55753
  this.invalidRoutes.push(path);
55751
55754
  }
55752
55755
  if (routerUrl !== locationUrl) {
55753
- nav.push(routerUrl);
55756
+ queueNavigation(routerUrl);
55754
55757
  }
55755
55758
  } else if (e.type === 0 && skipNavigation) {
55756
55759
  skipIds.push(e.id);
@@ -55761,7 +55764,7 @@ let RoutingService = class RoutingService {
55761
55764
  const locationUrl = nav.url;
55762
55765
  const routerUrl = e.routerEvent.url;
55763
55766
  if (routerUrl !== locationUrl) {
55764
- nav.push(routerUrl);
55767
+ queueNavigation(routerUrl);
55765
55768
  }
55766
55769
  } else {
55767
55770
  skipIds.splice(index, 1);
@@ -55809,7 +55812,7 @@ function prepareBootstrap(moduleOrComponent, piral) {
55809
55812
  if (typeof result !== 'object' || !('default' in result)) {
55810
55813
  throw new Error('The lazy loaded module does not `default` export a NgModule class.');
55811
55814
  }
55812
- (0,_module__WEBPACK_IMPORTED_MODULE_1__.defineModule)(result.default, moduleOrComponent.opts);
55815
+ (0,_module__WEBPACK_IMPORTED_MODULE_1__.defineModule)(result.default, moduleOrComponent.opts, moduleOrComponent.flags);
55813
55816
  return (0,_module__WEBPACK_IMPORTED_MODULE_1__.findModule)(result.default);
55814
55817
  });
55815
55818
  }
@@ -55843,8 +55846,8 @@ function prepareBootstrap(moduleOrComponent, piral) {
55843
55846
  }
55844
55847
  function bootstrap(result, node, props, context) {
55845
55848
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function* () {
55846
- const [selectedModule, ngOptions, component] = result;
55847
- const ref = yield (0,_startup__WEBPACK_IMPORTED_MODULE_3__.startup)(selectedModule, context, ngOptions);
55849
+ const [selectedModule, ngOptions, ngFlags, component] = result;
55850
+ const ref = yield (0,_startup__WEBPACK_IMPORTED_MODULE_3__.startup)(selectedModule, context, ngOptions, ngFlags);
55848
55851
  if (ref) {
55849
55852
  ref.instance.attach(component, node, props);
55850
55853
  return () => ref.instance.detach(component, node);
@@ -56004,10 +56007,11 @@ function instantiateModule(moduleDef, piral) {
56004
56007
  deps: []
56005
56008
  }];
56006
56009
  let BootstrapModule = BootstrapModule_1 = class BootstrapModule {
56007
- constructor(resolver, zone, routing) {
56010
+ constructor(resolver, zone, routing, flags) {
56008
56011
  this.resolver = resolver;
56009
56012
  this.zone = zone;
56010
56013
  this.routing = routing;
56014
+ this.flags = flags;
56011
56015
  this.refs = [];
56012
56016
  }
56013
56017
  ngDoBootstrap(appRef) {
@@ -56032,6 +56036,7 @@ function instantiateModule(moduleDef, piral) {
56032
56036
  }
56033
56037
  }
56034
56038
  detach(component, node) {
56039
+ var _a;
56035
56040
  for (let i = this.refs.length; i--;) {
56036
56041
  const [sourceComponent, sourceNode, ref] = this.refs[i];
56037
56042
  if (sourceComponent === component && sourceNode === node) {
@@ -56039,7 +56044,7 @@ function instantiateModule(moduleDef, piral) {
56039
56044
  this.refs.splice(i, 1);
56040
56045
  }
56041
56046
  }
56042
- if (this.refs.length === 0) {
56047
+ if (!((_a = this.flags) === null || _a === void 0 ? void 0 : _a.keepAlive) && this.refs.length === 0) {
56043
56048
  (0,_startup__WEBPACK_IMPORTED_MODULE_3__.teardown)(BootstrapModule_1);
56044
56049
  }
56045
56050
  }
@@ -56049,14 +56054,14 @@ function instantiateModule(moduleDef, piral) {
56049
56054
  // @ts-ignore
56050
56055
  entryComponents: components,
56051
56056
  providers
56052
- }), (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__metadata)("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_5__.ComponentFactoryResolver, _angular_core__WEBPACK_IMPORTED_MODULE_5__.NgZone, _RoutingService__WEBPACK_IMPORTED_MODULE_2__.RoutingService])], BootstrapModule);
56057
+ }), (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__param)(3, (0,_angular_core__WEBPACK_IMPORTED_MODULE_5__.Inject)('NgFlags')), (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__metadata)("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_5__.ComponentFactoryResolver, _angular_core__WEBPACK_IMPORTED_MODULE_5__.NgZone, _RoutingService__WEBPACK_IMPORTED_MODULE_2__.RoutingService, Object])], BootstrapModule);
56053
56058
  return BootstrapModule;
56054
56059
  }
56055
56060
  function activateModuleInstance(moduleDef, piral) {
56056
56061
  if (!moduleDef.active) {
56057
56062
  moduleDef.active = instantiateModule(moduleDef, piral);
56058
56063
  }
56059
- return [moduleDef.active, moduleDef.opts];
56064
+ return [moduleDef.active, moduleDef.opts, moduleDef.flags];
56060
56065
  }
56061
56066
  function getModuleInstance(component, standalone, piral) {
56062
56067
  const [moduleDef] = availableModules.filter(m => m.components.includes(component));
@@ -56088,13 +56093,14 @@ function createModuleInstance(component, standalone, piral) {
56088
56093
  function findModule(module) {
56089
56094
  return availableModules.find(m => m.module === module);
56090
56095
  }
56091
- function defineModule(module, opts = undefined) {
56096
+ function defineModule(module, opts = undefined, flags = undefined) {
56092
56097
  const [annotation] = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.getAnnotations)(module);
56093
56098
  if (annotation) {
56094
56099
  availableModules.push({
56095
56100
  active: undefined,
56096
56101
  components: (0,_utils__WEBPACK_IMPORTED_MODULE_7__.findComponents)(annotation.exports),
56097
56102
  module,
56103
+ flags,
56098
56104
  opts
56099
56105
  });
56100
56106
  } else if (typeof module === 'function') {
@@ -56106,6 +56112,7 @@ function defineModule(module, opts = undefined) {
56106
56112
  selector,
56107
56113
  module,
56108
56114
  opts,
56115
+ flags,
56109
56116
  state
56110
56117
  },
56111
56118
  type: 'ng'
@@ -56166,7 +56173,7 @@ const customPlatformDynamicFactory = (0,_angular_core__WEBPACK_IMPORTED_MODULE_1
56166
56173
  useValue: true
56167
56174
  }]);
56168
56175
  const runningModules = [];
56169
- function startNew(BootstrapModule, context, ngOptions) {
56176
+ function startNew(BootstrapModule, context, ngOptions, ngFlags) {
56170
56177
  const path = context.publicPath || '/';
56171
56178
  const platform = customPlatformDynamicFactory([{
56172
56179
  provide: 'Context',
@@ -56174,6 +56181,9 @@ function startNew(BootstrapModule, context, ngOptions) {
56174
56181
  }, {
56175
56182
  provide: _angular_common__WEBPACK_IMPORTED_MODULE_3__.APP_BASE_HREF,
56176
56183
  useValue: path
56184
+ }, {
56185
+ provide: 'NgFlags',
56186
+ useValue: ngFlags
56177
56187
  }]);
56178
56188
  const id = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getId)();
56179
56189
  const zoneIdentifier = `piral-ng:${id}`;
@@ -56208,7 +56218,7 @@ function teardown(BootstrapModule) {
56208
56218
  }
56209
56219
  }
56210
56220
  }
56211
- function startup(BootstrapModule, context, ngOptions) {
56221
+ function startup(BootstrapModule, context, ngOptions, ngFlags) {
56212
56222
  const runningModule = runningModules.find(([ref]) => ref === BootstrapModule);
56213
56223
  if (runningModule) {
56214
56224
  const [, instance, platform] = runningModule;
@@ -56218,7 +56228,7 @@ function startup(BootstrapModule, context, ngOptions) {
56218
56228
  return Promise.resolve(instance);
56219
56229
  }
56220
56230
  }
56221
- return startNew(BootstrapModule, context, ngOptions);
56231
+ return startNew(BootstrapModule, context, ngOptions, ngFlags);
56222
56232
  }
56223
56233
  if (true) {
56224
56234
  // May be used later for something useful. Right now only debugging output.
@@ -60749,12 +60759,12 @@ function installPiralDebug(options) {
60749
60759
  debug: debugApiVersion,
60750
60760
  instance: {
60751
60761
  name: "sample-cross-fx",
60752
- version: "1.2.0-beta.5863",
60762
+ version: "1.2.0-beta.5867",
60753
60763
  dependencies: "@angular/common,@angular/compiler,@angular/core,@angular/platform-browser,@angular/platform-browser-dynamic,@webcomponents/webcomponentsjs,angular,aurelia-framework,aurelia-templating-binding,aurelia-templating-resources,aurelia-pal-browser,aurelia-event-aggregator,aurelia-history-browser,hyperapp,inferno,inferno-create-element,mithril,lit-element,solid-js,solid-js/web,piral-ng/common,preact,riot,rxjs,vue,zone.js,tslib,react,react-dom,react-router,react-router-dom"
60754
60764
  },
60755
60765
  build: {
60756
- date: "2023-08-24T07:49:36.175Z",
60757
- cli: "1.2.0-beta.5863",
60766
+ date: "2023-08-28T11:27:14.892Z",
60767
+ cli: "1.2.0-beta.5867",
60758
60768
  compat: "1"
60759
60769
  }
60760
60770
  };
@@ -222290,4 +222300,4 @@ root.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8__.createElement(piral
222290
222300
 
222291
222301
  /******/ })()
222292
222302
  ;
222293
- //# sourceMappingURL=index.fe5ae2.js.map
222303
+ //# sourceMappingURL=index.df2fd7.js.map