@microzord/angular 1.0.0-alpha.2 → 2.0.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 (92) hide show
  1. package/README.md +10 -4
  2. package/child/src/create-app.d.ts +2 -2
  3. package/esm2022/child/index.mjs +3 -0
  4. package/esm2022/child/microzord-angular-child.mjs +5 -0
  5. package/esm2022/child/src/create-app.mjs +47 -0
  6. package/esm2022/child/src/enable-prod-mode.mjs +13 -0
  7. package/esm2022/index.mjs +9 -0
  8. package/esm2022/lib/microzord-app/microzord-app.directive.mjs +52 -0
  9. package/esm2022/lib/microzord-app/microzord-app.module.mjs +16 -0
  10. package/esm2022/lib/microzord-host.module.mjs +50 -0
  11. package/esm2022/lib/microzord-module/microzord-ng-compiler.service.mjs +33 -0
  12. package/esm2022/lib/microzord-module/microzord-ng-module.directive.mjs +53 -0
  13. package/esm2022/lib/microzord-module/microzord-ng-module.module.mjs +16 -0
  14. package/esm2022/lib/operators/complete.mjs +6 -0
  15. package/esm2022/lib/services/registry.service.mjs +20 -0
  16. package/esm2022/lib/tokens/microzord-apps.mjs +8 -0
  17. package/esm2022/lib/types/ng-module.mjs +2 -0
  18. package/esm2022/microzord-angular.mjs +5 -0
  19. package/fesm2022/microzord-angular-child.mjs +65 -0
  20. package/fesm2022/microzord-angular-child.mjs.map +1 -0
  21. package/fesm2022/microzord-angular.mjs +231 -0
  22. package/fesm2022/microzord-angular.mjs.map +1 -0
  23. package/lib/microzord-app/microzord-app.directive.d.ts +5 -1
  24. package/lib/microzord-app/microzord-app.module.d.ts +5 -0
  25. package/lib/microzord-host.module.d.ts +6 -0
  26. package/lib/microzord-module/microzord-ng-compiler.service.d.ts +3 -0
  27. package/lib/microzord-module/microzord-ng-module.directive.d.ts +5 -3
  28. package/lib/microzord-module/microzord-ng-module.module.d.ts +5 -0
  29. package/lib/services/registry.service.d.ts +3 -0
  30. package/lib/types/ng-module.d.ts +1 -1
  31. package/package.json +29 -17
  32. package/bundles/microzord-angular-child.umd.js +0 -417
  33. package/bundles/microzord-angular-child.umd.js.map +0 -1
  34. package/bundles/microzord-angular.umd.js +0 -612
  35. package/bundles/microzord-angular.umd.js.map +0 -1
  36. package/child/microzord-angular-child.d.ts +0 -4
  37. package/child/microzord-angular-child.metadata.json +0 -1
  38. package/child/package.json +0 -11
  39. package/esm2015/child/index.js +0 -3
  40. package/esm2015/child/index.js.map +0 -1
  41. package/esm2015/child/index.metadata.json +0 -1
  42. package/esm2015/child/microzord-angular-child.js +0 -5
  43. package/esm2015/child/microzord-angular-child.js.map +0 -1
  44. package/esm2015/child/microzord-angular-child.metadata.json +0 -1
  45. package/esm2015/child/src/create-app.js +0 -57
  46. package/esm2015/child/src/create-app.js.map +0 -1
  47. package/esm2015/child/src/create-app.metadata.json +0 -1
  48. package/esm2015/child/src/enable-prod-mode.js +0 -13
  49. package/esm2015/child/src/enable-prod-mode.js.map +0 -1
  50. package/esm2015/child/src/enable-prod-mode.metadata.json +0 -1
  51. package/esm2015/index.js +0 -9
  52. package/esm2015/index.js.map +0 -1
  53. package/esm2015/index.metadata.json +0 -1
  54. package/esm2015/lib/microzord-app/microzord-app.directive.js +0 -47
  55. package/esm2015/lib/microzord-app/microzord-app.directive.js.map +0 -1
  56. package/esm2015/lib/microzord-app/microzord-app.directive.metadata.json +0 -1
  57. package/esm2015/lib/microzord-app/microzord-app.module.js +0 -11
  58. package/esm2015/lib/microzord-app/microzord-app.module.js.map +0 -1
  59. package/esm2015/lib/microzord-app/microzord-app.module.metadata.json +0 -1
  60. package/esm2015/lib/microzord-host.module.js +0 -43
  61. package/esm2015/lib/microzord-host.module.js.map +0 -1
  62. package/esm2015/lib/microzord-host.module.metadata.json +0 -1
  63. package/esm2015/lib/microzord-module/microzord-ng-compiler.service.js +0 -39
  64. package/esm2015/lib/microzord-module/microzord-ng-compiler.service.js.map +0 -1
  65. package/esm2015/lib/microzord-module/microzord-ng-compiler.service.metadata.json +0 -1
  66. package/esm2015/lib/microzord-module/microzord-ng-module.directive.js +0 -54
  67. package/esm2015/lib/microzord-module/microzord-ng-module.directive.js.map +0 -1
  68. package/esm2015/lib/microzord-module/microzord-ng-module.directive.metadata.json +0 -1
  69. package/esm2015/lib/microzord-module/microzord-ng-module.module.js +0 -11
  70. package/esm2015/lib/microzord-module/microzord-ng-module.module.js.map +0 -1
  71. package/esm2015/lib/microzord-module/microzord-ng-module.module.metadata.json +0 -1
  72. package/esm2015/lib/operators/complete.js +0 -6
  73. package/esm2015/lib/operators/complete.js.map +0 -1
  74. package/esm2015/lib/operators/complete.metadata.json +0 -1
  75. package/esm2015/lib/services/registry.service.js +0 -18
  76. package/esm2015/lib/services/registry.service.js.map +0 -1
  77. package/esm2015/lib/services/registry.service.metadata.json +0 -1
  78. package/esm2015/lib/tokens/microzord-apps.js +0 -8
  79. package/esm2015/lib/tokens/microzord-apps.js.map +0 -1
  80. package/esm2015/lib/tokens/microzord-apps.metadata.json +0 -1
  81. package/esm2015/lib/types/ng-module.js +0 -2
  82. package/esm2015/lib/types/ng-module.js.map +0 -1
  83. package/esm2015/lib/types/ng-module.metadata.json +0 -1
  84. package/esm2015/microzord-angular.js +0 -6
  85. package/esm2015/microzord-angular.js.map +0 -1
  86. package/esm2015/microzord-angular.metadata.json +0 -1
  87. package/fesm2015/microzord-angular-child.js +0 -75
  88. package/fesm2015/microzord-angular-child.js.map +0 -1
  89. package/fesm2015/microzord-angular.js +0 -222
  90. package/fesm2015/microzord-angular.js.map +0 -1
  91. package/microzord-angular.d.ts +0 -5
  92. package/microzord-angular.metadata.json +0 -1
@@ -1,612 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@microzord/core'), require('rxjs'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@microzord/angular', ['exports', '@angular/core', '@microzord/core', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.microzord = global.microzord || {}, global.microzord.angular = {}), global.ng.core, global.core, global.rxjs, global.rxjs.operators));
5
- })(this, (function (exports, i0, core, rxjs, operators) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
-
27
- var complete = function (fn) { return operators.switchMap(function (value) { return rxjs.NEVER.pipe(operators.startWith(value), operators.finalize(function () {
28
- fn(value);
29
- })); }); };
30
-
31
- var MicrozordAppDirective = /** @class */ (function () {
32
- function MicrozordAppDirective(elementRef, ngZone, errorHandler) {
33
- var _this = this;
34
- this.elementRef = elementRef;
35
- this.ngZone = ngZone;
36
- this.errorHandler = errorHandler;
37
- this.destroy$ = new rxjs.Subject();
38
- this.name$ = new rxjs.Subject();
39
- this.application = this.name$.pipe(operators.tap(function () { return i0.NgZone.assertNotInAngularZone(); }), operators.switchMap(function (name) { return name
40
- ? core.bootstrapApp(name, _this.elementRef.nativeElement).pipe(complete(function (app) { return app.destroy(); }), operators.catchError(function (error) {
41
- _this.errorHandler.handleError(error);
42
- return rxjs.of(null);
43
- }))
44
- : rxjs.of(null); }), operators.shareReplay(1), operators.takeUntil(this.destroy$));
45
- this.hook = this.application.pipe(operators.switchMap(function (app) { return app
46
- ? new rxjs.Observable(function (subscriber) { return app.onHook(function (event) { return subscriber.next(event); }); })
47
- : rxjs.NEVER; }));
48
- this.application.subscribe();
49
- }
50
- Object.defineProperty(MicrozordAppDirective.prototype, "name", {
51
- set: function (appName) {
52
- var _this = this;
53
- this.ngZone.runOutsideAngular(function () { return _this.name$.next(appName); });
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- MicrozordAppDirective.prototype.ngOnDestroy = function () {
59
- this.destroy$.next();
60
- this.destroy$.complete();
61
- };
62
- return MicrozordAppDirective;
63
- }());
64
- MicrozordAppDirective.decorators = [
65
- { type: i0.Directive, args: [{
66
- selector: '[microzordApp]:not(ng-container)',
67
- },] }
68
- ];
69
- MicrozordAppDirective.ctorParameters = function () { return [
70
- { type: i0.ElementRef },
71
- { type: i0.NgZone },
72
- { type: i0.ErrorHandler }
73
- ]; };
74
- MicrozordAppDirective.propDecorators = {
75
- hook: [{ type: i0.Output }],
76
- application: [{ type: i0.Output }],
77
- name: [{ type: i0.Input, args: ['microzordApp',] }]
78
- };
79
-
80
- var MicrozordAppModule = /** @class */ (function () {
81
- function MicrozordAppModule() {
82
- }
83
- return MicrozordAppModule;
84
- }());
85
- MicrozordAppModule.decorators = [
86
- { type: i0.NgModule, args: [{
87
- declarations: [MicrozordAppDirective],
88
- exports: [MicrozordAppDirective],
89
- },] }
90
- ];
91
-
92
- /*! *****************************************************************************
93
- Copyright (c) Microsoft Corporation.
94
-
95
- Permission to use, copy, modify, and/or distribute this software for any
96
- purpose with or without fee is hereby granted.
97
-
98
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
99
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
100
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
101
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
102
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
103
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
104
- PERFORMANCE OF THIS SOFTWARE.
105
- ***************************************************************************** */
106
- /* global Reflect, Promise */
107
- var extendStatics = function (d, b) {
108
- extendStatics = Object.setPrototypeOf ||
109
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
110
- function (d, b) { for (var p in b)
111
- if (Object.prototype.hasOwnProperty.call(b, p))
112
- d[p] = b[p]; };
113
- return extendStatics(d, b);
114
- };
115
- function __extends(d, b) {
116
- if (typeof b !== "function" && b !== null)
117
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
118
- extendStatics(d, b);
119
- function __() { this.constructor = d; }
120
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
121
- }
122
- var __assign = function () {
123
- __assign = Object.assign || function __assign(t) {
124
- for (var s, i = 1, n = arguments.length; i < n; i++) {
125
- s = arguments[i];
126
- for (var p in s)
127
- if (Object.prototype.hasOwnProperty.call(s, p))
128
- t[p] = s[p];
129
- }
130
- return t;
131
- };
132
- return __assign.apply(this, arguments);
133
- };
134
- function __rest(s, e) {
135
- var t = {};
136
- for (var p in s)
137
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
138
- t[p] = s[p];
139
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
140
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
141
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
142
- t[p[i]] = s[p[i]];
143
- }
144
- return t;
145
- }
146
- function __decorate(decorators, target, key, desc) {
147
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
148
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
149
- r = Reflect.decorate(decorators, target, key, desc);
150
- else
151
- for (var i = decorators.length - 1; i >= 0; i--)
152
- if (d = decorators[i])
153
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
154
- return c > 3 && r && Object.defineProperty(target, key, r), r;
155
- }
156
- function __param(paramIndex, decorator) {
157
- return function (target, key) { decorator(target, key, paramIndex); };
158
- }
159
- function __metadata(metadataKey, metadataValue) {
160
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
161
- return Reflect.metadata(metadataKey, metadataValue);
162
- }
163
- function __awaiter(thisArg, _arguments, P, generator) {
164
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
165
- return new (P || (P = Promise))(function (resolve, reject) {
166
- function fulfilled(value) { try {
167
- step(generator.next(value));
168
- }
169
- catch (e) {
170
- reject(e);
171
- } }
172
- function rejected(value) { try {
173
- step(generator["throw"](value));
174
- }
175
- catch (e) {
176
- reject(e);
177
- } }
178
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
179
- step((generator = generator.apply(thisArg, _arguments || [])).next());
180
- });
181
- }
182
- function __generator(thisArg, body) {
183
- var _ = { label: 0, sent: function () { if (t[0] & 1)
184
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
185
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
186
- function verb(n) { return function (v) { return step([n, v]); }; }
187
- function step(op) {
188
- if (f)
189
- throw new TypeError("Generator is already executing.");
190
- while (_)
191
- try {
192
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
193
- return t;
194
- if (y = 0, t)
195
- op = [op[0] & 2, t.value];
196
- switch (op[0]) {
197
- case 0:
198
- case 1:
199
- t = op;
200
- break;
201
- case 4:
202
- _.label++;
203
- return { value: op[1], done: false };
204
- case 5:
205
- _.label++;
206
- y = op[1];
207
- op = [0];
208
- continue;
209
- case 7:
210
- op = _.ops.pop();
211
- _.trys.pop();
212
- continue;
213
- default:
214
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
215
- _ = 0;
216
- continue;
217
- }
218
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
219
- _.label = op[1];
220
- break;
221
- }
222
- if (op[0] === 6 && _.label < t[1]) {
223
- _.label = t[1];
224
- t = op;
225
- break;
226
- }
227
- if (t && _.label < t[2]) {
228
- _.label = t[2];
229
- _.ops.push(op);
230
- break;
231
- }
232
- if (t[2])
233
- _.ops.pop();
234
- _.trys.pop();
235
- continue;
236
- }
237
- op = body.call(thisArg, _);
238
- }
239
- catch (e) {
240
- op = [6, e];
241
- y = 0;
242
- }
243
- finally {
244
- f = t = 0;
245
- }
246
- if (op[0] & 5)
247
- throw op[1];
248
- return { value: op[0] ? op[1] : void 0, done: true };
249
- }
250
- }
251
- var __createBinding = Object.create ? (function (o, m, k, k2) {
252
- if (k2 === undefined)
253
- k2 = k;
254
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
255
- }) : (function (o, m, k, k2) {
256
- if (k2 === undefined)
257
- k2 = k;
258
- o[k2] = m[k];
259
- });
260
- function __exportStar(m, o) {
261
- for (var p in m)
262
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
263
- __createBinding(o, m, p);
264
- }
265
- function __values(o) {
266
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
267
- if (m)
268
- return m.call(o);
269
- if (o && typeof o.length === "number")
270
- return {
271
- next: function () {
272
- if (o && i >= o.length)
273
- o = void 0;
274
- return { value: o && o[i++], done: !o };
275
- }
276
- };
277
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
278
- }
279
- function __read(o, n) {
280
- var m = typeof Symbol === "function" && o[Symbol.iterator];
281
- if (!m)
282
- return o;
283
- var i = m.call(o), r, ar = [], e;
284
- try {
285
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
286
- ar.push(r.value);
287
- }
288
- catch (error) {
289
- e = { error: error };
290
- }
291
- finally {
292
- try {
293
- if (r && !r.done && (m = i["return"]))
294
- m.call(i);
295
- }
296
- finally {
297
- if (e)
298
- throw e.error;
299
- }
300
- }
301
- return ar;
302
- }
303
- /** @deprecated */
304
- function __spread() {
305
- for (var ar = [], i = 0; i < arguments.length; i++)
306
- ar = ar.concat(__read(arguments[i]));
307
- return ar;
308
- }
309
- /** @deprecated */
310
- function __spreadArrays() {
311
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
312
- s += arguments[i].length;
313
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
314
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
315
- r[k] = a[j];
316
- return r;
317
- }
318
- function __spreadArray(to, from) {
319
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
320
- to[j] = from[i];
321
- return to;
322
- }
323
- function __await(v) {
324
- return this instanceof __await ? (this.v = v, this) : new __await(v);
325
- }
326
- function __asyncGenerator(thisArg, _arguments, generator) {
327
- if (!Symbol.asyncIterator)
328
- throw new TypeError("Symbol.asyncIterator is not defined.");
329
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
330
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
331
- function verb(n) { if (g[n])
332
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
333
- function resume(n, v) { try {
334
- step(g[n](v));
335
- }
336
- catch (e) {
337
- settle(q[0][3], e);
338
- } }
339
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
340
- function fulfill(value) { resume("next", value); }
341
- function reject(value) { resume("throw", value); }
342
- function settle(f, v) { if (f(v), q.shift(), q.length)
343
- resume(q[0][0], q[0][1]); }
344
- }
345
- function __asyncDelegator(o) {
346
- var i, p;
347
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
348
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
349
- }
350
- function __asyncValues(o) {
351
- if (!Symbol.asyncIterator)
352
- throw new TypeError("Symbol.asyncIterator is not defined.");
353
- var m = o[Symbol.asyncIterator], i;
354
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
355
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
356
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
357
- }
358
- function __makeTemplateObject(cooked, raw) {
359
- if (Object.defineProperty) {
360
- Object.defineProperty(cooked, "raw", { value: raw });
361
- }
362
- else {
363
- cooked.raw = raw;
364
- }
365
- return cooked;
366
- }
367
- ;
368
- var __setModuleDefault = Object.create ? (function (o, v) {
369
- Object.defineProperty(o, "default", { enumerable: true, value: v });
370
- }) : function (o, v) {
371
- o["default"] = v;
372
- };
373
- function __importStar(mod) {
374
- if (mod && mod.__esModule)
375
- return mod;
376
- var result = {};
377
- if (mod != null)
378
- for (var k in mod)
379
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
380
- __createBinding(result, mod, k);
381
- __setModuleDefault(result, mod);
382
- return result;
383
- }
384
- function __importDefault(mod) {
385
- return (mod && mod.__esModule) ? mod : { default: mod };
386
- }
387
- function __classPrivateFieldGet(receiver, privateMap) {
388
- if (!privateMap.has(receiver)) {
389
- throw new TypeError("attempted to get private field on non-instance");
390
- }
391
- return privateMap.get(receiver);
392
- }
393
- function __classPrivateFieldSet(receiver, privateMap, value) {
394
- if (!privateMap.has(receiver)) {
395
- throw new TypeError("attempted to set private field on non-instance");
396
- }
397
- privateMap.set(receiver, value);
398
- return value;
399
- }
400
-
401
- var MicrozordNgCompilerService = /** @class */ (function () {
402
- function MicrozordNgCompilerService(compiler, componentFactoryResolver, injector, viewContainerRef) {
403
- this.compiler = compiler;
404
- this.componentFactoryResolver = componentFactoryResolver;
405
- this.injector = injector;
406
- this.viewContainerRef = viewContainerRef;
407
- }
408
- MicrozordNgCompilerService.prototype.createModule = function (Module, injector) {
409
- if (injector === void 0) { injector = this.injector; }
410
- return __awaiter(this, void 0, void 0, function () {
411
- var moduleFactory;
412
- return __generator(this, function (_a) {
413
- switch (_a.label) {
414
- case 0: return [4 /*yield*/, this.compiler.compileModuleAsync(Module)];
415
- case 1:
416
- moduleFactory = _a.sent();
417
- return [2 /*return*/, moduleFactory.create(injector)];
418
- }
419
- });
420
- });
421
- };
422
- MicrozordNgCompilerService.prototype.createEntryPoint = function (moduleRef, injector, viewContainerRef) {
423
- if (injector === void 0) { injector = this.injector; }
424
- if (viewContainerRef === void 0) { viewContainerRef = this.viewContainerRef; }
425
- return __awaiter(this, void 0, void 0, function () {
426
- var componentFactory;
427
- return __generator(this, function (_a) {
428
- componentFactory = this.componentFactoryResolver.resolveComponentFactory(moduleRef.instance.getEntryPoint());
429
- viewContainerRef.clear();
430
- return [2 /*return*/, viewContainerRef.createComponent(componentFactory, undefined, injector, [], moduleRef)];
431
- });
432
- });
433
- };
434
- MicrozordNgCompilerService.prototype.createEntryPointFromModule = function (Module, injector, viewContainerRef) {
435
- if (injector === void 0) { injector = this.injector; }
436
- if (viewContainerRef === void 0) { viewContainerRef = this.viewContainerRef; }
437
- return __awaiter(this, void 0, void 0, function () {
438
- var moduleRef;
439
- return __generator(this, function (_a) {
440
- switch (_a.label) {
441
- case 0: return [4 /*yield*/, this.createModule(Module, injector)];
442
- case 1:
443
- moduleRef = _a.sent();
444
- return [2 /*return*/, this.createEntryPoint(moduleRef, injector, viewContainerRef)];
445
- }
446
- });
447
- });
448
- };
449
- return MicrozordNgCompilerService;
450
- }());
451
- MicrozordNgCompilerService.decorators = [
452
- { type: i0.Injectable }
453
- ];
454
- MicrozordNgCompilerService.ctorParameters = function () { return [
455
- { type: i0.Compiler },
456
- { type: i0.ComponentFactoryResolver },
457
- { type: i0.Injector, decorators: [{ type: i0.Optional }] },
458
- { type: i0.ViewContainerRef, decorators: [{ type: i0.Optional }] }
459
- ]; };
460
-
461
- var MicrozordNgModuleDirective = /** @class */ (function () {
462
- function MicrozordNgModuleDirective(ngZone, componentFactoryResolver, mzNgCompiler, errorHandler) {
463
- var _this = this;
464
- this.ngZone = ngZone;
465
- this.componentFactoryResolver = componentFactoryResolver;
466
- this.mzNgCompiler = mzNgCompiler;
467
- this.errorHandler = errorHandler;
468
- this.name$ = new rxjs.Subject();
469
- this.destroy$ = new rxjs.Subject();
470
- this.module = this.name$.pipe(operators.tap(function () { return i0.NgZone.assertNotInAngularZone(); }), operators.switchMap(function (name) { return name
471
- ? _this.loadModuleAndBootstrap(name).pipe(operators.catchError(function (error) {
472
- _this.errorHandler.handleError(error);
473
- return rxjs.of(null);
474
- }))
475
- : rxjs.of(null); }), operators.map(function (componentRef) { var _a; return (_a = componentRef === null || componentRef === void 0 ? void 0 : componentRef.injector.get(i0.NgModuleRef)) !== null && _a !== void 0 ? _a : null; }), operators.shareReplay(1), operators.takeUntil(this.destroy$));
476
- this.module.subscribe();
477
- }
478
- Object.defineProperty(MicrozordNgModuleDirective.prototype, "name", {
479
- set: function (moduleName) {
480
- var _this = this;
481
- this.ngZone.runOutsideAngular(function () { return _this.name$.next(moduleName); });
482
- },
483
- enumerable: false,
484
- configurable: true
485
- });
486
- MicrozordNgModuleDirective.prototype.loadModuleAndBootstrap = function (name) {
487
- var _this = this;
488
- return core.loadEntity(name).pipe(operators.switchMap(function (Module) { return _this.mzNgCompiler.createEntryPointFromModule(Module); }), complete(function (componentRef) { return _this.destroyComponentAndModule(componentRef); }));
489
- };
490
- MicrozordNgModuleDirective.prototype.destroyComponentAndModule = function (componentRef) {
491
- componentRef.destroy();
492
- componentRef.injector.get(i0.NgModuleRef).destroy();
493
- };
494
- MicrozordNgModuleDirective.prototype.ngOnDestroy = function () {
495
- this.destroy$.next();
496
- this.destroy$.complete();
497
- };
498
- return MicrozordNgModuleDirective;
499
- }());
500
- MicrozordNgModuleDirective.decorators = [
501
- { type: i0.Directive, args: [{
502
- selector: '[microzordNgModule]',
503
- providers: [MicrozordNgCompilerService],
504
- },] }
505
- ];
506
- MicrozordNgModuleDirective.ctorParameters = function () { return [
507
- { type: i0.NgZone },
508
- { type: i0.ComponentFactoryResolver },
509
- { type: MicrozordNgCompilerService },
510
- { type: i0.ErrorHandler }
511
- ]; };
512
- MicrozordNgModuleDirective.propDecorators = {
513
- module: [{ type: i0.Output }],
514
- name: [{ type: i0.Input, args: ['microzordNgModule',] }]
515
- };
516
-
517
- var MicrozordNgModuleModule = /** @class */ (function () {
518
- function MicrozordNgModuleModule() {
519
- }
520
- return MicrozordNgModuleModule;
521
- }());
522
- MicrozordNgModuleModule.decorators = [
523
- { type: i0.NgModule, args: [{
524
- declarations: [MicrozordNgModuleDirective],
525
- exports: [MicrozordNgModuleDirective],
526
- },] }
527
- ];
528
-
529
- var MICROZORD_APPS = new i0.InjectionToken('Microzord apps', {
530
- factory: function () { return []; },
531
- });
532
- var MICROZORD_NG_MODULES = new i0.InjectionToken('Microzord Angular modules', {
533
- factory: function () { return []; },
534
- });
535
-
536
- var RegistryService = /** @class */ (function () {
537
- function RegistryService() {
538
- }
539
- RegistryService.prototype.registerMany = function (apps) {
540
- var _this = this;
541
- apps.forEach(function (app) { return _this.register(app); });
542
- };
543
- RegistryService.prototype.register = function (options) {
544
- core.registerEntity(options);
545
- };
546
- return RegistryService;
547
- }());
548
- RegistryService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function RegistryService_Factory() { return new RegistryService(); }, token: RegistryService, providedIn: "root" });
549
- RegistryService.decorators = [
550
- { type: i0.Injectable, args: [{
551
- providedIn: 'root',
552
- },] }
553
- ];
554
-
555
- var MicrozordHostModule = /** @class */ (function () {
556
- function MicrozordHostModule(allApps, allModules, registry) {
557
- allApps.forEach(function (apps) { return registry.registerMany(apps); });
558
- allModules.forEach(function (modules) { return registry.registerMany(modules); });
559
- }
560
- MicrozordHostModule.register = function (_a) {
561
- var apps = _a.apps, modules = _a.modules;
562
- return {
563
- ngModule: MicrozordHostModule,
564
- providers: [
565
- apps
566
- ? {
567
- provide: MICROZORD_APPS,
568
- useValue: apps,
569
- multi: true,
570
- }
571
- : [],
572
- modules
573
- ? {
574
- provide: MICROZORD_NG_MODULES,
575
- useValue: modules,
576
- multi: true,
577
- }
578
- : [],
579
- ],
580
- };
581
- };
582
- return MicrozordHostModule;
583
- }());
584
- MicrozordHostModule.decorators = [
585
- { type: i0.NgModule, args: [{
586
- exports: [MicrozordAppModule, MicrozordNgModuleModule],
587
- },] }
588
- ];
589
- MicrozordHostModule.ctorParameters = function () { return [
590
- { type: Array, decorators: [{ type: i0.Inject, args: [MICROZORD_APPS,] }] },
591
- { type: Array, decorators: [{ type: i0.Inject, args: [MICROZORD_NG_MODULES,] }] },
592
- { type: RegistryService }
593
- ]; };
594
-
595
- /**
596
- * Generated bundle index. Do not edit.
597
- */
598
-
599
- exports.MICROZORD_APPS = MICROZORD_APPS;
600
- exports.MICROZORD_NG_MODULES = MICROZORD_NG_MODULES;
601
- exports.MicrozordAppDirective = MicrozordAppDirective;
602
- exports.MicrozordAppModule = MicrozordAppModule;
603
- exports.MicrozordHostModule = MicrozordHostModule;
604
- exports.MicrozordNgModuleDirective = MicrozordNgModuleDirective;
605
- exports.MicrozordNgModuleModule = MicrozordNgModuleModule;
606
- exports.RegistryService = RegistryService;
607
- exports["ɵa"] = MicrozordNgCompilerService;
608
-
609
- Object.defineProperty(exports, '__esModule', { value: true });
610
-
611
- }));
612
- //# sourceMappingURL=microzord-angular.umd.js.map