zmp-cli 3.15.5 → 3.15.6-beta.1
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 +1 -0
- package/build/index.js +1 -184
- package/config/index.js +1 -44
- package/create/index.js +1 -230
- package/create/init-zmp-ui.js +1 -216
- package/create/templates/app-parameters.js +9 -25
- package/create/templates/common/webpack/build.js +2 -40
- package/create/templates/copy-assets.js +1 -158
- package/create/templates/core/copy-assets.js +14 -82
- package/create/templates/core/generate-home-page.js +16 -38
- package/create/templates/core/generate-root.js +28 -63
- package/create/templates/core/generate-routes.js +12 -38
- package/create/templates/core/generate-scripts.js +16 -65
- package/create/templates/create-folders.js +1 -30
- package/create/templates/generate-config-xml.js +2 -9
- package/create/templates/generate-index.js +10 -35
- package/create/templates/generate-manifest.js +1 -49
- package/create/templates/generate-recoil.js +4 -16
- package/create/templates/generate-routes.js +1 -16
- package/create/templates/generate-scripts.js +1 -16
- package/create/templates/generate-service-worker.js +4 -10
- package/create/templates/generate-store.js +4 -15
- package/create/templates/generate-styles.js +10 -64
- package/create/templates/generate-webpack-config.js +43 -125
- package/create/templates/generate-zmp-custom.js +14 -72
- package/create/templates/react/copy-assets.js +1 -85
- package/create/templates/react/generate-home-page.js +20 -50
- package/create/templates/react/generate-root.js +15 -44
- package/create/templates/react/generate-routes.js +1 -16
- package/create/templates/react/generate-scripts.js +12 -38
- package/create/templates/react/pages/404.js +2 -10
- package/create/templates/react/pages/about.js +2 -10
- package/create/templates/react/pages/catalog.js +3 -17
- package/create/templates/react/pages/dynamic-route.js +2 -10
- package/create/templates/react/pages/form.js +6 -26
- package/create/templates/react/pages/index copy.js +1 -17
- package/create/templates/react/pages/index.js +1 -17
- package/create/templates/react/pages/settings.js +3 -17
- package/create/templates/react/pages/user.js +8 -27
- package/create/templates/react-typescript/components/app-items.js +2 -9
- package/create/templates/react-typescript/components/index.js +1 -9
- package/create/templates/react-typescript/components/navbar-back.js +2 -9
- package/create/templates/react-typescript/components/user-card.js +2 -9
- package/create/templates/react-typescript/copy-assets.js +1 -94
- package/create/templates/react-typescript/generate-home-page.js +20 -52
- package/create/templates/react-typescript/generate-root.js +14 -45
- package/create/templates/react-typescript/generate-routes.js +1 -12
- package/create/templates/react-typescript/generate-scripts.js +12 -37
- package/create/templates/react-typescript/pages/404.js +2 -10
- package/create/templates/react-typescript/pages/about.js +2 -10
- package/create/templates/react-typescript/pages/catalog.js +3 -17
- package/create/templates/react-typescript/pages/dynamic-route.js +2 -10
- package/create/templates/react-typescript/pages/form.js +6 -26
- package/create/templates/react-typescript/pages/index.js +1 -17
- package/create/templates/react-typescript/pages/settings.js +3 -17
- package/create/templates/react-typescript/pages/user.js +8 -27
- package/create/templates/svelte/copy-assets.js +1 -47
- package/create/templates/svelte/generate-home-page.js +20 -56
- package/create/templates/svelte/generate-root.js +22 -80
- package/create/templates/svelte/generate-routes.js +7 -22
- package/create/templates/svelte/generate-scripts.js +7 -23
- package/create/templates/vue/copy-assets.js +1 -67
- package/create/templates/vue/generate-home-page.js +2 -8
- package/create/templates/vue/generate-root.js +3 -13
- package/create/templates/vue/generate-routes.js +1 -7
- package/create/templates/vue/generate-scripts.js +9 -26
- package/create/templates/vue/global-components.d.js +1 -0
- package/create/templates/zaui/copy-assets.js +1 -90
- package/create/templates/zaui/generate-home-page.js +27 -53
- package/create/templates/zaui/generate-root.js +14 -34
- package/create/templates/zaui/generate-routes.js +1 -10
- package/create/templates/zaui/generate-scripts.js +6 -20
- package/create/templates/zaui/generate-user-card.js +3 -18
- package/create/templates/zaui/pages/about.js +3 -20
- package/create/templates/zaui/pages/form.js +3 -20
- package/create/templates/zaui/pages/index.js +1 -9
- package/create/templates/zaui/pages/user.js +3 -20
- package/create/utils/colors.js +1 -94
- package/create/utils/generate-app-config.js +1 -34
- package/create/utils/generate-gitignore.js +1 -43
- package/create/utils/generate-npm-scripts.js +1 -26
- package/create/utils/generate-package-json.js +1 -132
- package/create/utils/generate-readme.js +1 -28
- package/create/utils/get-options.js +1 -204
- package/create/utils/indent.js +1 -31
- package/create/utils/npm-scripts.js +1 -62
- package/create/utils/string.js +1 -13
- package/create/utils/styles-extension.js +1 -9
- package/create/utils/template-if.js +1 -9
- package/deploy/index.js +1 -148
- package/deploy/utils/get-options.js +1 -69
- package/deploy/utils/request-upload.js +1 -34
- package/deploy/utils/upload-app.js +1 -82
- package/index.js +1 -319
- package/login/index.js +1 -169
- package/login/utils/get-options.js +1 -58
- package/login/utils/zalo-login.js +1 -32
- package/migrate/icons/update-icon-v3.js +1 -19
- package/migrate/index.js +1 -60
- package/migrate/utils/get-options.js +1 -46
- package/migrate/utils/migrate-react.js +1 -33
- package/package.json +11 -39
- package/start/generate-hr-config.js +1 -59
- package/start/index.js +1 -382
- package/sync/index-to-app-config.js +1 -146
- package/sync/index.js +1 -55
- package/utils/axios.js +1 -15
- package/utils/check-update.js +1 -53
- package/utils/constants.js +1 -20
- package/utils/env.js +1 -39
- package/utils/error.js +1 -16
- package/utils/find-files-by-ext.js +1 -27
- package/utils/find-free-port.js +1 -11
- package/utils/fs-extra.js +1 -90
- package/utils/generate-pages-map.js +1 -17
- package/utils/get-app-info.js +1 -22
- package/utils/get-current-project.js +1 -25
- package/utils/get-ip.js +1 -19
- package/utils/log.js +1 -19
- package/utils/node-blob.js +1 -106
- package/utils/resumable.d.js +1 -0
- package/utils/resumable.js +1 -1204
- package/utils/spinner.js +1 -25
- package/utils/tunnel.js +1 -36
- package/.editorconfig +0 -15
- package/.eslintignore +0 -8
- package/.eslintrc.js +0 -10
- package/.vscode/launch.json +0 -23
- package/LICENSE +0 -21
- package/README.git.md +0 -37
- package/assets/index.js +0 -147
- package/build/dist/index.dev.js +0 -217
- package/config/dist/index.dev.js +0 -48
- package/create/templates/dist/generate-styles.dev.js +0 -46
- package/create/utils/dist/get-options.dev.js +0 -277
- package/deploy/dist/index.dev.js +0 -227
- package/dist/index.dev.js +0 -352
- package/jsconfig.json +0 -8
- package/login/dist/index.dev.js +0 -223
- package/screenshots/wellcome.jpg +0 -0
- package/show-qr-app/assets/css/style.css +0 -87
- package/show-qr-app/assets/js/qrcode.min.js +0 -1
- package/show-qr-app/index.html +0 -57
- package/show-qr-app/package.json +0 -14
- package/start/dist/index.dev.js +0 -312
- package/ui/server.js +0 -194
- package/ui/www/css/app.css +0 -1
- package/ui/www/css/app.css.map +0 -1
- package/ui/www/fonts/ZMPIcons-Regular.eot +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.ttf +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff2 +0 -0
- package/ui/www/images/logo.png +0 -0
- package/ui/www/index.html +0 -1
- package/ui/www/js/app.js +0 -3
- package/ui/www/js/app.js.LICENSE.txt +0 -20
- package/ui/www/js/app.js.map +0 -1
- package/ui/www/static/icons/apple-touch-icon.png +0 -0
- package/ui/www/static/icons/favicon.png +0 -0
- package/utils/dist/get-app-info.dev.js +0 -54
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
const { template } = options;
|
|
5
|
-
const hideNavBar =
|
|
6
|
-
template === 'tabs'
|
|
7
|
-
? `onPageBeforeIn={()=>{
|
|
1
|
+
"use strict";const e=require("../../../utils/indent");module.exports=t=>{let{template:a}=t,o="tabs"===a?`onPageBeforeIn={()=>{
|
|
8
2
|
//hide navbar
|
|
9
3
|
zmp.toolbar.hide('#app-tab-bar')
|
|
10
|
-
}}
|
|
11
|
-
: '';
|
|
12
|
-
|
|
13
|
-
if (options.stateManagement === 'recoil') {
|
|
14
|
-
return indent(
|
|
15
|
-
0,
|
|
16
|
-
`
|
|
4
|
+
}}`:"";return"recoil"===t.stateManagement?e(0,`
|
|
17
5
|
import React from 'react';
|
|
18
6
|
import { Button, Card, Input, Page, Box, zmp } from 'zmp-framework/react';
|
|
19
7
|
import { useRecoilState } from 'recoil';
|
|
@@ -45,7 +33,7 @@ module.exports = (options) => {
|
|
|
45
33
|
return (
|
|
46
34
|
<Page
|
|
47
35
|
name="user-form"
|
|
48
|
-
${
|
|
36
|
+
${o}
|
|
49
37
|
>
|
|
50
38
|
<NavbarBack title="Update user info" />
|
|
51
39
|
<Box>
|
|
@@ -77,13 +65,7 @@ module.exports = (options) => {
|
|
|
77
65
|
}
|
|
78
66
|
|
|
79
67
|
export default FormPage;
|
|
80
|
-
`
|
|
81
|
-
).trim();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return indent(
|
|
85
|
-
0,
|
|
86
|
-
`
|
|
68
|
+
`).trim():e(0,`
|
|
87
69
|
import React from 'react';
|
|
88
70
|
import { Button, Card, Input, Page, useStore, zmp, Box } from 'zmp-framework/react';
|
|
89
71
|
import NavbarBack from '../components/navbar-back';
|
|
@@ -115,7 +97,7 @@ module.exports = (options) => {
|
|
|
115
97
|
return (
|
|
116
98
|
<Page
|
|
117
99
|
name="user-form"
|
|
118
|
-
${
|
|
100
|
+
${o}
|
|
119
101
|
>
|
|
120
102
|
<NavbarBack title="Update user info" />
|
|
121
103
|
<Box>
|
|
@@ -147,6 +129,4 @@ module.exports = (options) => {
|
|
|
147
129
|
}
|
|
148
130
|
|
|
149
131
|
export default FormPage;
|
|
150
|
-
`
|
|
151
|
-
).trim();
|
|
152
|
-
};
|
|
132
|
+
`).trim()};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const copyForm = require('./form');
|
|
3
|
-
const copyDynamicRoute = require('./dynamic-route');
|
|
4
|
-
const copyAbout = require('./about');
|
|
5
|
-
const copy404 = require('./404');
|
|
6
|
-
const copySettings = require('./settings');
|
|
7
|
-
const copyCatalog = require('./catalog');
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
copyUser,
|
|
11
|
-
copyForm,
|
|
12
|
-
copyDynamicRoute,
|
|
13
|
-
copyAbout,
|
|
14
|
-
copy404,
|
|
15
|
-
copySettings,
|
|
16
|
-
copyCatalog,
|
|
17
|
-
};
|
|
1
|
+
"use strict";const e=require("./user"),r=require("./form"),u=require("./dynamic-route"),i=require("./about"),t=require("./404"),o=require("./settings"),q=require("./catalog");module.exports={copyUser:e,copyForm:r,copyDynamicRoute:u,copyAbout:i,copy404:t,copySettings:o,copyCatalog:q};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
if (options.stateManagement === 'recoil') {
|
|
6
|
-
return indent(
|
|
7
|
-
0,
|
|
8
|
-
`
|
|
1
|
+
"use strict";const e=require("../../../utils/indent");module.exports=t=>"recoil"===t.stateManagement?e(0,`
|
|
9
2
|
import React from "react";
|
|
10
3
|
import { useRecoilValue } from 'recoil';
|
|
11
4
|
import {
|
|
@@ -36,12 +29,7 @@ module.exports = (options) => {
|
|
|
36
29
|
};
|
|
37
30
|
|
|
38
31
|
export default SettingsPage;
|
|
39
|
-
`
|
|
40
|
-
).trim();
|
|
41
|
-
}
|
|
42
|
-
return indent(
|
|
43
|
-
0,
|
|
44
|
-
`
|
|
32
|
+
`).trim():e(0,`
|
|
45
33
|
import React from "react";
|
|
46
34
|
import {
|
|
47
35
|
Page,
|
|
@@ -71,6 +59,4 @@ module.exports = (options) => {
|
|
|
71
59
|
};
|
|
72
60
|
|
|
73
61
|
export default SettingsPage;
|
|
74
|
-
`
|
|
75
|
-
).trim();
|
|
76
|
-
};
|
|
62
|
+
`).trim();
|
|
@@ -1,37 +1,20 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
const { template, stateManagement } = options;
|
|
5
|
-
const hideNavBar =
|
|
6
|
-
template === 'tabs'
|
|
7
|
-
? `
|
|
1
|
+
"use strict";const e=require("../../../utils/indent");module.exports=t=>{let{template:r,stateManagement:a}=t,s="tabs"===r?`
|
|
8
2
|
onPageBeforeIn={()=>{
|
|
9
3
|
//hide navbar
|
|
10
4
|
zmp.toolbar.hide('#app-tab-bar')
|
|
11
|
-
}}
|
|
12
|
-
: '';
|
|
13
|
-
const modules = ['Avatar', 'List', 'ListItem', 'Page', 'Title'];
|
|
14
|
-
if (stateManagement === 'store') {
|
|
15
|
-
modules.push('useStore');
|
|
16
|
-
}
|
|
17
|
-
if (template === 'tabs') {
|
|
18
|
-
modules.push('zmp');
|
|
19
|
-
}
|
|
20
|
-
return indent(
|
|
21
|
-
0,
|
|
22
|
-
`
|
|
5
|
+
}}`:"",i=["Avatar","List","ListItem","Page","Title"];return"store"===a&&i.push("useStore"),"tabs"===r&&i.push("zmp"),e(0,`
|
|
23
6
|
import React from 'react'
|
|
24
|
-
import { ${
|
|
25
|
-
import NavbarBack from '../components/navbar-back'${
|
|
7
|
+
import { ${i.join(", ")} } from 'zmp-framework/react'
|
|
8
|
+
import NavbarBack from '../components/navbar-back'${"recoil"===a?`
|
|
26
9
|
import { useRecoilValue } from 'recoil';
|
|
27
|
-
import { userState } from '../state'
|
|
10
|
+
import { userState } from '../state';`:""}
|
|
28
11
|
|
|
29
12
|
const UserPage = () => {
|
|
30
|
-
${
|
|
13
|
+
${"recoil"===a?"const user = useRecoilValue(userState);":"const user = useStore('user')"}
|
|
31
14
|
|
|
32
15
|
return (
|
|
33
16
|
<Page
|
|
34
|
-
name="user"${
|
|
17
|
+
name="user"${s}
|
|
35
18
|
>
|
|
36
19
|
<NavbarBack
|
|
37
20
|
title="User info"
|
|
@@ -51,6 +34,4 @@ module.exports = (options) => {
|
|
|
51
34
|
}
|
|
52
35
|
|
|
53
36
|
export default UserPage;
|
|
54
|
-
`
|
|
55
|
-
).trim();
|
|
56
|
-
};
|
|
37
|
+
`).trim()};
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
const path =
|
|
2
|
-
const generateHomePage = require('./generate-home-page');
|
|
3
|
-
const generateRoot = require('./generate-root');
|
|
4
|
-
const generateStore = require('../generate-store');
|
|
5
|
-
|
|
6
|
-
module.exports = (options) => {
|
|
7
|
-
const cwd = options.cwd || process.cwd();
|
|
8
|
-
const { template, bundler } = options;
|
|
9
|
-
const toCopy = [];
|
|
10
|
-
|
|
11
|
-
// Copy Pages
|
|
12
|
-
const pages = [
|
|
13
|
-
...(template !== 'blank' ? ['404', 'about', 'dynamic-route', 'form'] : []),
|
|
14
|
-
...(template === 'tabs' ? ['catalog', 'product', 'settings'] : []),
|
|
15
|
-
...(template === 'split-view' ? ['left-page-1', 'left-page-2'] : []),
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
pages.forEach((p) => {
|
|
19
|
-
const src = path.resolve(__dirname, 'pages', `${p}.svelte`);
|
|
20
|
-
const dest = path.resolve(cwd, 'src', 'pages', `${p}.svelte`);
|
|
21
|
-
toCopy.push({
|
|
22
|
-
from: src,
|
|
23
|
-
to: dest,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
toCopy.push({
|
|
27
|
-
content: generateHomePage(options),
|
|
28
|
-
to: path.resolve(cwd, 'src', 'pages', 'home.svelte'),
|
|
29
|
-
});
|
|
30
|
-
toCopy.push({
|
|
31
|
-
content: generateRoot(options),
|
|
32
|
-
to: path.resolve(cwd, 'src', 'components', 'app.svelte'),
|
|
33
|
-
});
|
|
34
|
-
toCopy.push({
|
|
35
|
-
content: generateStore(options),
|
|
36
|
-
to: path.resolve(cwd, 'src', 'store.js'),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
if (bundler) {
|
|
40
|
-
toCopy.push({
|
|
41
|
-
from: path.resolve(__dirname, 'babel.config.js'),
|
|
42
|
-
to: path.resolve(cwd, 'babel.config.js'),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return toCopy;
|
|
47
|
-
};
|
|
1
|
+
"use strict";const e=require("path"),t=require("./generate-home-page"),s=require("./generate-root"),r=require("../generate-store");module.exports=o=>{let a=o.cwd||process.cwd(),{template:l,bundler:n}=o,c=[];return[..."blank"!==l?["404","about","dynamic-route","form"]:[],..."tabs"===l?["catalog","product","settings"]:[],..."split-view"===l?["left-page-1","left-page-2"]:[]].forEach(t=>{let s=e.resolve(__dirname,"pages",`${t}.svelte`),r=e.resolve(a,"src","pages",`${t}.svelte`);c.push({from:s,to:r})}),c.push({content:t(o),to:e.resolve(a,"src","pages","home.svelte")}),c.push({content:s(o),to:e.resolve(a,"src","components","app.svelte")}),c.push({content:r(o),to:e.resolve(a,"src","store.js")}),n&&c.push({from:e.resolve(__dirname,"babel.config.js"),to:e.resolve(a,"babel.config.js")}),c};
|
|
@@ -1,77 +1,49 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
const { name, template } = options;
|
|
5
|
-
|
|
6
|
-
let description;
|
|
7
|
-
if (template === 'single-view' || template === 'blank') {
|
|
8
|
-
description = `
|
|
1
|
+
"use strict";const t=require("../../utils/indent");module.exports=e=>{let i;let{name:a,template:o}=e;return("single-view"===o||"blank"===o)&&(i=`
|
|
9
2
|
<p>Here is your blank ZMP app. Let's see what we have here.</p>
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
if (template === 'split-view') {
|
|
13
|
-
description = `
|
|
3
|
+
`),"split-view"===o&&(i=`
|
|
14
4
|
<p>This is an example of split view application layout, commonly used on tablets. The main approach of such kind of layout is that you can see different views at the same time.</p>
|
|
15
5
|
|
|
16
6
|
<p>Each view may have different layout, different navbar type (dynamic, fixed or static) or without navbar.</p>
|
|
17
7
|
|
|
18
8
|
<p>The fun thing is that you can easily control one view from another without any line of JavaScript just using "data-view" attribute on links.</p>
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
if (template === 'tabs') {
|
|
22
|
-
description = `
|
|
9
|
+
`),"tabs"===o&&(i=`
|
|
23
10
|
<p>This is an example of tabs-layout application. The main point of such tabbed layout is that each tab contains independent view with its own routing and navigation.</p>
|
|
24
11
|
|
|
25
12
|
<p>Each tab/view may have different layout, different navbar type (dynamic, fixed or static) or without navbar like this tab.</p>
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return indent(
|
|
30
|
-
0,
|
|
31
|
-
`
|
|
13
|
+
`),t(0,`
|
|
32
14
|
<Page name="home">
|
|
33
15
|
<!-- Top Navbar -->
|
|
34
|
-
${
|
|
35
|
-
template === 'blank'
|
|
36
|
-
? `
|
|
16
|
+
${"blank"===o?`
|
|
37
17
|
<Navbar large>
|
|
38
|
-
<NavTitle>${
|
|
39
|
-
<NavTitleLarge>${
|
|
18
|
+
<NavTitle>${a}</NavTitle>
|
|
19
|
+
<NavTitleLarge>${a}</NavTitleLarge>
|
|
40
20
|
</Navbar>
|
|
41
|
-
`.trim()
|
|
42
|
-
: `
|
|
21
|
+
`.trim():`
|
|
43
22
|
<Navbar large sliding={false}>
|
|
44
23
|
<NavLeft>
|
|
45
24
|
<Link iconIos="zmp:menu" iconAurora="zmp:menu" iconMd="material:menu" panelOpen="left" />
|
|
46
25
|
</NavLeft>
|
|
47
|
-
<NavTitle sliding>${
|
|
26
|
+
<NavTitle sliding>${a}</NavTitle>
|
|
48
27
|
<NavRight>
|
|
49
28
|
<Link iconIos="zmp:menu" iconAurora="zmp:menu" iconMd="material:menu" panelOpen="right" />
|
|
50
29
|
</NavRight>
|
|
51
|
-
<NavTitleLarge>${
|
|
30
|
+
<NavTitleLarge>${a}</NavTitleLarge>
|
|
52
31
|
</Navbar>
|
|
53
|
-
`.trim()
|
|
54
|
-
|
|
55
|
-
${
|
|
56
|
-
template !== 'tabs'
|
|
57
|
-
? `
|
|
32
|
+
`.trim()}
|
|
33
|
+
${"tabs"!==o?`
|
|
58
34
|
<!-- Toolbar -->
|
|
59
35
|
<Toolbar bottom>
|
|
60
36
|
<Link>Left Link</Link>
|
|
61
37
|
<Link>Right Link</Link>
|
|
62
38
|
</Toolbar>
|
|
63
39
|
|
|
64
|
-
`.trim()
|
|
65
|
-
: ''
|
|
66
|
-
}
|
|
40
|
+
`.trim():""}
|
|
67
41
|
<!-- Page content -->
|
|
68
42
|
<Block strong>
|
|
69
|
-
${
|
|
43
|
+
${i.trim()}
|
|
70
44
|
</Block>
|
|
71
45
|
|
|
72
|
-
${
|
|
73
|
-
template !== 'blank'
|
|
74
|
-
? `
|
|
46
|
+
${"blank"!==o?`
|
|
75
47
|
<BlockTitle>Navigation</BlockTitle>
|
|
76
48
|
<List>
|
|
77
49
|
<ListItem link="/about/" title="About"/>
|
|
@@ -112,13 +84,9 @@ module.exports = (options) => {
|
|
|
112
84
|
link="/load-something-that-doesnt-exist/"
|
|
113
85
|
/>
|
|
114
86
|
</List>
|
|
115
|
-
`.trim()
|
|
116
|
-
: ''
|
|
117
|
-
}
|
|
87
|
+
`.trim():""}
|
|
118
88
|
</Page>
|
|
119
|
-
${
|
|
120
|
-
template === 'blank'
|
|
121
|
-
? `
|
|
89
|
+
${"blank"===o?`
|
|
122
90
|
<script>
|
|
123
91
|
import {
|
|
124
92
|
Page,
|
|
@@ -130,8 +98,7 @@ module.exports = (options) => {
|
|
|
130
98
|
Block,
|
|
131
99
|
} from 'zmp-svelte';
|
|
132
100
|
</script>
|
|
133
|
-
`.trim()
|
|
134
|
-
: `
|
|
101
|
+
`.trim():`
|
|
135
102
|
<script>
|
|
136
103
|
import {
|
|
137
104
|
Page,
|
|
@@ -151,8 +118,5 @@ module.exports = (options) => {
|
|
|
151
118
|
Button
|
|
152
119
|
} from 'zmp-svelte';
|
|
153
120
|
</script>
|
|
154
|
-
`.trim()
|
|
155
|
-
|
|
156
|
-
`
|
|
157
|
-
).trim();
|
|
158
|
-
};
|
|
121
|
+
`.trim()}
|
|
122
|
+
`).trim()};
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const templateIf = require('../../utils/template-if');
|
|
3
|
-
const appParameters = require('../app-parameters');
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const { template, theming } = options;
|
|
7
|
-
|
|
8
|
-
// Panels
|
|
9
|
-
const leftPanelPlain = indent(
|
|
10
|
-
6,
|
|
11
|
-
`
|
|
1
|
+
"use strict";const e=require("../../utils/indent"),t=require("../../utils/template-if"),i=require("../app-parameters");module.exports=a=>{let{template:o,theming:l}=a,n=e(6,`
|
|
12
2
|
<!-- Left panel with cover effect-->
|
|
13
3
|
<Panel left cover themeDark>
|
|
14
4
|
<View>
|
|
@@ -18,12 +8,7 @@ module.exports = (options) => {
|
|
|
18
8
|
</Page>
|
|
19
9
|
</View>
|
|
20
10
|
</Panel>
|
|
21
|
-
`
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const leftPanelWithView = indent(
|
|
25
|
-
6,
|
|
26
|
-
`
|
|
11
|
+
`),r=e(6,`
|
|
27
12
|
<!-- Left panel with cover effect when hidden -->
|
|
28
13
|
<Panel left cover themeDark visibleBreakpoint={960}>
|
|
29
14
|
<View>
|
|
@@ -43,13 +28,7 @@ module.exports = (options) => {
|
|
|
43
28
|
</Page>
|
|
44
29
|
</View>
|
|
45
30
|
</Panel>
|
|
46
|
-
`
|
|
47
|
-
);
|
|
48
|
-
const leftPanel =
|
|
49
|
-
template === 'split-view' ? leftPanelWithView : leftPanelPlain;
|
|
50
|
-
const rightPanel = indent(
|
|
51
|
-
6,
|
|
52
|
-
`
|
|
31
|
+
`),s=e(6,`
|
|
53
32
|
<!-- Right panel with reveal effect-->
|
|
54
33
|
<Panel right reveal themeDark>
|
|
55
34
|
<View>
|
|
@@ -59,28 +38,10 @@ module.exports = (options) => {
|
|
|
59
38
|
</Page>
|
|
60
39
|
</View>
|
|
61
40
|
</Panel>
|
|
62
|
-
`
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
// Views
|
|
66
|
-
let views = '';
|
|
67
|
-
if (
|
|
68
|
-
template === 'single-view' ||
|
|
69
|
-
template === 'split-view' ||
|
|
70
|
-
template === 'blank'
|
|
71
|
-
) {
|
|
72
|
-
views = indent(
|
|
73
|
-
6,
|
|
74
|
-
`
|
|
41
|
+
`),p="";return("single-view"===o||"split-view"===o||"blank"===o)&&(p=e(6,`
|
|
75
42
|
<!-- Your main view, should have "view-main" class -->
|
|
76
43
|
<View main class="safe-areas" url="/" />
|
|
77
|
-
`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
if (template === 'tabs') {
|
|
81
|
-
views = indent(
|
|
82
|
-
6,
|
|
83
|
-
`
|
|
44
|
+
`)),"tabs"===o&&(p=e(6,`
|
|
84
45
|
<!-- Views/Tabs container -->
|
|
85
46
|
<Views tabs class="safe-areas">
|
|
86
47
|
<!-- Tabbar for switching views-tabs -->
|
|
@@ -100,25 +61,16 @@ module.exports = (options) => {
|
|
|
100
61
|
<View id="view-settings" name="settings" tab url="/settings/" />
|
|
101
62
|
|
|
102
63
|
</Views>
|
|
103
|
-
`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return indent(
|
|
108
|
-
0,
|
|
109
|
-
`
|
|
110
|
-
${
|
|
111
|
-
template === 'blank'
|
|
112
|
-
? `
|
|
113
|
-
<App { ...zmpparams } ${theming.darkTheme ? 'themeDark' : ''}>
|
|
114
|
-
${views}
|
|
64
|
+
`)),e(0,`
|
|
65
|
+
${"blank"===o?`
|
|
66
|
+
<App { ...zmpparams } ${l.darkTheme?"themeDark":""}>
|
|
67
|
+
${p}
|
|
115
68
|
</App>
|
|
116
|
-
`.trim()
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
${
|
|
120
|
-
${
|
|
121
|
-
${views}
|
|
69
|
+
`.trim():`
|
|
70
|
+
<App { ...zmpparams } ${l.darkTheme?"themeDark":""}>
|
|
71
|
+
${"split-view"===o?r:n}
|
|
72
|
+
${s}
|
|
73
|
+
${p}
|
|
122
74
|
|
|
123
75
|
<!-- Popup -->
|
|
124
76
|
<Popup id="my-popup">
|
|
@@ -164,21 +116,17 @@ module.exports = (options) => {
|
|
|
164
116
|
</View>
|
|
165
117
|
</LoginScreen>
|
|
166
118
|
</App>
|
|
167
|
-
`.trim()
|
|
168
|
-
}
|
|
119
|
+
`.trim()}
|
|
169
120
|
<script>
|
|
170
121
|
import { onMount } from 'svelte';
|
|
171
|
-
${
|
|
172
|
-
template === 'blank',
|
|
173
|
-
() => `
|
|
122
|
+
${t("blank"===o,()=>`
|
|
174
123
|
import {
|
|
175
124
|
zmp,
|
|
176
125
|
zmpready,
|
|
177
126
|
App,
|
|
178
127
|
View,
|
|
179
128
|
} from 'zmp-svelte';
|
|
180
|
-
`,
|
|
181
|
-
() => `
|
|
129
|
+
`,()=>`
|
|
182
130
|
import {
|
|
183
131
|
zmp,
|
|
184
132
|
zmpready,
|
|
@@ -202,17 +150,14 @@ module.exports = (options) => {
|
|
|
202
150
|
ListButton,
|
|
203
151
|
BlockFooter
|
|
204
152
|
} from 'zmp-svelte';
|
|
205
|
-
`
|
|
206
|
-
)}
|
|
153
|
+
`)}
|
|
207
154
|
import store from '../store';
|
|
208
155
|
|
|
209
156
|
// ZMP Parameters
|
|
210
157
|
let zmpparams = {
|
|
211
|
-
${
|
|
158
|
+
${e(8,i(a)).trim()}
|
|
212
159
|
};
|
|
213
|
-
${
|
|
214
|
-
template !== 'blank',
|
|
215
|
-
() => `
|
|
160
|
+
${t("blank"!==o,()=>`
|
|
216
161
|
// Login screen demo data
|
|
217
162
|
let username = '';
|
|
218
163
|
let password = '';
|
|
@@ -222,14 +167,11 @@ module.exports = (options) => {
|
|
|
222
167
|
zmp.loginScreen.close();
|
|
223
168
|
});
|
|
224
169
|
}
|
|
225
|
-
`
|
|
226
|
-
)}
|
|
170
|
+
`)}
|
|
227
171
|
onMount(() => {
|
|
228
172
|
zmpready(() => {
|
|
229
173
|
// Call ZMP APIs here
|
|
230
174
|
});
|
|
231
175
|
})
|
|
232
176
|
</script>
|
|
233
|
-
`
|
|
234
|
-
).trim();
|
|
235
|
-
};
|
|
177
|
+
`).trim()};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const {
|
|
6
|
-
template,
|
|
7
|
-
} = options;
|
|
8
|
-
|
|
9
|
-
if (template === 'blank') {
|
|
10
|
-
return indent(0, `
|
|
1
|
+
"use strict";const e=require("../../utils/template-if"),t=require("../../utils/indent");module.exports=o=>{let{template:a}=o;return"blank"===a?t(0,`
|
|
11
2
|
import HomePage from './pages/home.svelte';
|
|
12
3
|
|
|
13
4
|
var routes = [
|
|
@@ -18,19 +9,16 @@ module.exports = (options) => {
|
|
|
18
9
|
];
|
|
19
10
|
|
|
20
11
|
export default routes;
|
|
21
|
-
`)
|
|
22
|
-
}
|
|
23
|
-
// Webpack Routes
|
|
24
|
-
const routes = indent(0, `
|
|
12
|
+
`):t(0,`
|
|
25
13
|
import HomePage from './pages/home.svelte';
|
|
26
14
|
import AboutPage from './pages/about.svelte';
|
|
27
15
|
import FormPage from './pages/form.svelte';
|
|
28
|
-
${
|
|
16
|
+
${e("tabs"===a,()=>`
|
|
29
17
|
import CatalogPage from './pages/catalog.svelte';
|
|
30
18
|
import ProductPage from './pages/product.svelte';
|
|
31
19
|
import SettingsPage from './pages/settings.svelte';
|
|
32
20
|
`)}
|
|
33
|
-
${
|
|
21
|
+
${e("split-view"===a,()=>`
|
|
34
22
|
import LeftPage1 from './pages/left-page-1.svelte';
|
|
35
23
|
import LeftPage2 from './pages/left-page-2.svelte';
|
|
36
24
|
`)}
|
|
@@ -50,7 +38,7 @@ module.exports = (options) => {
|
|
|
50
38
|
path: '/form/',
|
|
51
39
|
component: FormPage,
|
|
52
40
|
},
|
|
53
|
-
${
|
|
41
|
+
${e("tabs"===a,()=>`
|
|
54
42
|
{
|
|
55
43
|
path: '/catalog/',
|
|
56
44
|
component: CatalogPage,
|
|
@@ -64,7 +52,7 @@ module.exports = (options) => {
|
|
|
64
52
|
component: SettingsPage,
|
|
65
53
|
},
|
|
66
54
|
`)}
|
|
67
|
-
${
|
|
55
|
+
${e("split-view"===a,()=>`
|
|
68
56
|
{
|
|
69
57
|
path: '/left-page-1/',
|
|
70
58
|
component: LeftPage1,
|
|
@@ -85,7 +73,4 @@ module.exports = (options) => {
|
|
|
85
73
|
];
|
|
86
74
|
|
|
87
75
|
export default routes;
|
|
88
|
-
`);
|
|
89
|
-
|
|
90
|
-
return routes;
|
|
91
|
-
};
|
|
76
|
+
`)};
|
|
@@ -1,35 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
const stylesExtension = require('../../utils/styles-extension');
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const {
|
|
7
|
-
cssPreProcessor,
|
|
8
|
-
theming,
|
|
9
|
-
customBuild,
|
|
10
|
-
} = options;
|
|
11
|
-
|
|
12
|
-
let scripts = '';
|
|
13
|
-
|
|
14
|
-
scripts += indent(0, `
|
|
1
|
+
"use strict";const t=require("../../utils/template-if"),e=require("../../utils/indent"),p=require("../../utils/styles-extension");module.exports=o=>{let{cssPreProcessor:s,theming:m,customBuild:r}=o,n="";return(n+=e(0,`
|
|
15
2
|
// Import ZMP
|
|
16
|
-
import ZMP from '${
|
|
3
|
+
import ZMP from '${r?"./zmp-custom.js":"zmp-framework/core/lite-bundle"}';
|
|
17
4
|
|
|
18
5
|
// Import ZMP-Svelte Plugin
|
|
19
6
|
import ZMPSvelte from 'zmp-svelte';
|
|
20
7
|
|
|
21
8
|
// Import ZMP Styles
|
|
22
|
-
${
|
|
9
|
+
${t(r,()=>`
|
|
23
10
|
import '../css/zmp-custom.less';
|
|
24
|
-
`,
|
|
11
|
+
`,()=>`
|
|
25
12
|
import 'zmp-framework/zmp-bundle.min.css';
|
|
26
13
|
`)}
|
|
27
14
|
|
|
28
15
|
// Import Icons and App Custom Styles
|
|
29
|
-
${
|
|
16
|
+
${t(m.iconFonts,()=>`
|
|
30
17
|
import '../css/icons.css';
|
|
31
18
|
`)}
|
|
32
|
-
import '../css/app.${
|
|
19
|
+
import '../css/app.${p(s)}';
|
|
33
20
|
|
|
34
21
|
// Import App Component
|
|
35
22
|
import App from '../components/app.svelte';
|
|
@@ -41,7 +28,4 @@ module.exports = (options) => {
|
|
|
41
28
|
const app = new App({
|
|
42
29
|
target: document.getElementById('app'),
|
|
43
30
|
});
|
|
44
|
-
`);
|
|
45
|
-
|
|
46
|
-
return scripts.trim();
|
|
47
|
-
};
|
|
31
|
+
`)).trim()};
|