piral-ng 0.15.0-beta.4815 → 0.15.0-beta.4820

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/README.md CHANGED
@@ -106,6 +106,21 @@ export class AngularPage { /* ... */ }
106
106
 
107
107
  which defines the selector (`angular-page`) matching the specified selector in the `setup` function.
108
108
 
109
+ ### Standalone Components
110
+
111
+ The `piral-ng` plugin also supports Angular standalone components as rendering source.
112
+
113
+ Standalone components can also be used with lazy loading.
114
+
115
+ ```ts
116
+ import { PiletApi } from '<name-of-piral-instance>';
117
+
118
+ export function setup(piral: PiletApi) {
119
+ // Just make sure that `AngularPage` exports the component as `default` export
120
+ piral.registerPage('/sample', piral.fromNg(() => import('./AngularPage')));
121
+ }
122
+ ```
123
+
109
124
  ### Angular Options
110
125
 
111
126
  You can optionally provide Options to `defineNgModule`, which are identical to those given to `bootstrapModule` during the Angular boot process. See https://angular.io/api/core/PlatformRef#bootstrapModule for possible values.
package/esm/types.d.ts CHANGED
@@ -38,6 +38,17 @@ export interface NgLazyType {
38
38
  opts: NgOptions;
39
39
  state: any;
40
40
  }
41
+ /**
42
+ * The lazy loading interface for retrieving Angular components.
43
+ */
44
+ export interface LazyType<T> {
45
+ /**
46
+ * Callback to be invoked for lazy loading an Angular module or component.
47
+ */
48
+ (): Promise<{
49
+ default: Type<T>;
50
+ }>;
51
+ }
41
52
  /**
42
53
  * Represents the interface implemented by a module definer function.
43
54
  */
@@ -54,9 +65,7 @@ export interface NgModuleDefiner {
54
65
  * @param opts The options to pass when bootstrapping.
55
66
  * @returns The module ID to be used to reference components.
56
67
  */
57
- <T>(getModule: () => Promise<{
58
- default: Type<T>;
59
- }>, opts?: NgOptions): NgComponentLoader;
68
+ <T>(getModule: LazyType<T>, opts?: NgOptions): NgComponentLoader;
60
69
  }
61
70
  export interface NgComponent {
62
71
  /**
package/lib/types.d.ts CHANGED
@@ -38,6 +38,17 @@ export interface NgLazyType {
38
38
  opts: NgOptions;
39
39
  state: any;
40
40
  }
41
+ /**
42
+ * The lazy loading interface for retrieving Angular components.
43
+ */
44
+ export interface LazyType<T> {
45
+ /**
46
+ * Callback to be invoked for lazy loading an Angular module or component.
47
+ */
48
+ (): Promise<{
49
+ default: Type<T>;
50
+ }>;
51
+ }
41
52
  /**
42
53
  * Represents the interface implemented by a module definer function.
43
54
  */
@@ -54,9 +65,7 @@ export interface NgModuleDefiner {
54
65
  * @param opts The options to pass when bootstrapping.
55
66
  * @returns The module ID to be used to reference components.
56
67
  */
57
- <T>(getModule: () => Promise<{
58
- default: Type<T>;
59
- }>, opts?: NgOptions): NgComponentLoader;
68
+ <T>(getModule: LazyType<T>, opts?: NgOptions): NgComponentLoader;
60
69
  }
61
70
  export interface NgComponent {
62
71
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-ng",
3
- "version": "0.15.0-beta.4815",
3
+ "version": "0.15.0-beta.4820",
4
4
  "description": "Plugin for integrating Angular components in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -79,7 +79,7 @@
79
79
  "@angular/platform-browser": "^14.0.0",
80
80
  "@angular/platform-browser-dynamic": "^14.0.0",
81
81
  "@angular/router": "^14.0.0",
82
- "piral-core": "0.15.0-beta.4815",
82
+ "piral-core": "0.15.0-beta.4820",
83
83
  "rxjs": "^7.3.0"
84
84
  },
85
85
  "peerDependencies": {
@@ -90,5 +90,5 @@
90
90
  "@angular/router": "^2.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
91
91
  "rxjs": "^5.0.0 || ^6.0.0 || ^7.0.0"
92
92
  },
93
- "gitHead": "4942bf8aff67eca5fce289da420399421f0d27de"
93
+ "gitHead": "2b5a24273c5893cb5573429396d8991d282268b8"
94
94
  }
package/src/types.ts CHANGED
@@ -42,6 +42,16 @@ export interface NgLazyType {
42
42
  state: any;
43
43
  }
44
44
 
45
+ /**
46
+ * The lazy loading interface for retrieving Angular components.
47
+ */
48
+ export interface LazyType<T> {
49
+ /**
50
+ * Callback to be invoked for lazy loading an Angular module or component.
51
+ */
52
+ (): Promise<{ default: Type<T> }>;
53
+ }
54
+
45
55
  /**
46
56
  * Represents the interface implemented by a module definer function.
47
57
  */
@@ -58,7 +68,7 @@ export interface NgModuleDefiner {
58
68
  * @param opts The options to pass when bootstrapping.
59
69
  * @returns The module ID to be used to reference components.
60
70
  */
61
- <T>(getModule: () => Promise<{ default: Type<T> }>, opts?: NgOptions): NgComponentLoader;
71
+ <T>(getModule: LazyType<T>, opts?: NgOptions): NgComponentLoader;
62
72
  }
63
73
 
64
74
  export interface NgComponent {