1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | const common_1 = require("@angular/common");
|
8 | const core_1 = require("@angular/core");
|
9 | const platform_server_1 = require("@angular/platform-server");
|
10 | const hydrate_1 = require("@ionic/core/hydrate");
|
11 |
|
12 | class IonicServerModule {
|
13 | }
|
14 | IonicServerModule.decorators = [
|
15 | { type: core_1.NgModule, args: [{
|
16 | providers: [
|
17 | {
|
18 | provide: platform_server_1.BEFORE_APP_SERIALIZED,
|
19 | useFactory: hydrateIonicComponents,
|
20 | multi: true,
|
21 | deps: [common_1.DOCUMENT, core_1.APP_ID]
|
22 | }
|
23 | ]
|
24 | },] },
|
25 | ];
|
26 | exports.IonicServerModule = IonicServerModule;
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | function hydrateIonicComponents(doc, appId) {
|
34 | return ( |
35 |
|
36 |
|
37 | () => {
|
38 | return hydrate_1.hydrateDocument(doc, {
|
39 | clientHydrateAnnotations: false
|
40 | })
|
41 | .then(( |
42 |
|
43 |
|
44 |
|
45 | hydrateResults => {
|
46 | hydrateResults.diagnostics.forEach(( |
47 |
|
48 |
|
49 |
|
50 | d => {
|
51 | if (d.type === 'error') {
|
52 | console.error(d.messageText);
|
53 | }
|
54 | else if (d.type === 'debug') {
|
55 | console.debug(d.messageText);
|
56 | }
|
57 | else {
|
58 | console.log(d.messageText);
|
59 | }
|
60 | }));
|
61 | if (doc.head != null) {
|
62 |
|
63 | const styleElms = ( (doc.head.querySelectorAll('style[data-styles]')));
|
64 | for (let i = 0; i < styleElms.length; i++) {
|
65 | styleElms[i].setAttribute('ng-transition', appId);
|
66 | }
|
67 | }
|
68 | if (doc.body != null) {
|
69 |
|
70 | const ionPages = ( (doc.body.querySelectorAll('.ion-page.ion-page-invisible')));
|
71 | for (let i = 0; i < ionPages.length; i++) {
|
72 | ionPages[i].classList.remove('ion-page-invisible');
|
73 | }
|
74 | }
|
75 | }));
|
76 | });
|
77 | }
|
78 | exports.hydrateIonicComponents = hydrateIonicComponents;
|