-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathapp-parameters.js
93 lines (90 loc) · 2.38 KB
/
app-parameters.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const indent = require('../utils/indent');
const templateIf = require('../utils/template-if');
module.exports = (options) => {
const { type, framework, name, bundler, theming } = options;
const hasCordova = type.indexOf('cordova') >= 0;
const hasCapacitor = type.indexOf('capacitor') >= 0;
// prettier-ignore
return indent(
0,
`
name: '${name}', // App name
theme: 'auto', // Automatic theme detection
${templateIf(theming.customColor, () => `
colors: {
primary: '${theming.color}',
},
`)}
${templateIf(theming.darkMode, () => `
darkMode: true,
`)}
${templateIf(framework === 'core', () => `
el: '#app', // App root element
`)}
${templateIf(framework === 'core' && bundler, () => `
component: App, // App main component
`)}
// App store
store: store,
// App routes
routes: routes,
${templateIf(type.indexOf('pwa') >= 0 && !bundler, () => `
// Register service worker
serviceWorker: {
path: '/service-worker.js',
},
`)}
${templateIf(type.indexOf('pwa') >= 0 && bundler, () => `
// Register service worker (only on production build)
serviceWorker: process.env.NODE_ENV ==='production' ? {
path: '/service-worker.js',
} : {},
`)}
${templateIf(hasCapacitor, () => `
// Input settings
input: {
scrollIntoViewOnFocus: device.capacitor,
scrollIntoViewCentered: device.capacitor,
},
// Capacitor Statusbar settings
statusbar: {
iosOverlaysWebView: true,
androidOverlaysWebView: false,
},
${templateIf(framework === 'core',() => `
on: {
init: function () {
var f7 = this;
if (f7.device.capacitor) {
// Init capacitor APIs (see capacitor-app.js)
capacitorApp.init(f7);
}
},
},
`)}
`)}
${templateIf(hasCordova, () => `
// Input settings
input: {
scrollIntoViewOnFocus: device.cordova,
scrollIntoViewCentered: device.cordova,
},
// Cordova Statusbar settings
statusbar: {
iosOverlaysWebView: true,
androidOverlaysWebView: false,
},
${templateIf(framework === 'core', () => `
on: {
init: function () {
var f7 = this;
if (f7.device.cordova) {
// Init cordova APIs (see cordova-app.js)
cordovaApp.init(f7);
}
},
},`)}
`)}
`,
).trim();
};