1 | import { __decorate } from 'tslib';
|
2 | import { DOCUMENT } from '@angular/common';
|
3 | import { NgModule, APP_ID } from '@angular/core';
|
4 | import { BEFORE_APP_SERIALIZED } from '@angular/platform-server';
|
5 | import { hydrateDocument } from '@ionic/core/hydrate';
|
6 |
|
7 |
|
8 | let IonicServerModule = class IonicServerModule {
|
9 | };
|
10 | IonicServerModule = __decorate([
|
11 | NgModule({
|
12 | providers: [
|
13 | {
|
14 | provide: BEFORE_APP_SERIALIZED,
|
15 | useFactory: hydrateIonicComponents,
|
16 | multi: true,
|
17 | deps: [DOCUMENT, APP_ID]
|
18 | }
|
19 | ]
|
20 | })
|
21 | ], IonicServerModule);
|
22 |
|
23 |
|
24 | function hydrateIonicComponents(doc, appId) {
|
25 | return () => {
|
26 | return hydrateDocument(doc, {
|
27 | clientHydrateAnnotations: false,
|
28 | excludeComponents: [
|
29 |
|
30 | 'ion-action-sheet',
|
31 | 'ion-alert',
|
32 | 'ion-loading',
|
33 | 'ion-modal',
|
34 | 'ion-picker',
|
35 | 'ion-popover',
|
36 | 'ion-toast',
|
37 | 'ion-toast',
|
38 |
|
39 | 'ion-router',
|
40 | 'ion-route',
|
41 | 'ion-route-redirect',
|
42 | 'ion-router-link',
|
43 | 'ion-router-outlet',
|
44 |
|
45 | 'ion-tabs',
|
46 | 'ion-tab',
|
47 |
|
48 | 'ion-picker-column',
|
49 | 'ion-virtual-scroll'
|
50 | ]
|
51 | })
|
52 | .then(hydrateResults => {
|
53 | hydrateResults.diagnostics.forEach(d => {
|
54 | if (d.type === 'error') {
|
55 | console.error(d.messageText);
|
56 | }
|
57 | else if (d.type === 'debug') {
|
58 | console.debug(d.messageText);
|
59 | }
|
60 | else {
|
61 | console.log(d.messageText);
|
62 | }
|
63 | });
|
64 | if (doc.head != null) {
|
65 | const styleElms = doc.head.querySelectorAll('style[data-styles]');
|
66 | for (let i = 0; i < styleElms.length; i++) {
|
67 | styleElms[i].setAttribute('ng-transition', appId);
|
68 | }
|
69 | }
|
70 | if (doc.body != null) {
|
71 | const ionPages = doc.body.querySelectorAll('.ion-page.ion-page-invisible');
|
72 | for (let i = 0; i < ionPages.length; i++) {
|
73 | ionPages[i].classList.remove('ion-page-invisible');
|
74 | }
|
75 | }
|
76 | });
|
77 | };
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | export { IonicServerModule, hydrateIonicComponents as ɵa };
|
85 |
|