zmp-cli 3.15.6 → 3.15.8
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 +37 -0
- package/build/index.js +1 -184
- package/config/index.js +1 -44
- package/create/index.js +1 -230
- package/create/utils/generate-app-config.js +1 -34
- package/create/utils/generate-npm-scripts.js +1 -26
- package/create/utils/get-options.js +1 -204
- package/create/utils/npm-scripts.js +1 -62
- package/deploy/index.js +1 -149
- 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 +13 -40
- package/start/frame/index.html +264 -254
- 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/init-zmp-ui.js +0 -216
- package/create/templates/app-parameters.js +0 -33
- package/create/templates/common/css/icons.css +0 -60
- package/create/templates/common/icons/512x512.png +0 -0
- package/create/templates/common/icons/apple-touch-icon.png +0 -0
- package/create/templates/common/icons/favicon.png +0 -0
- package/create/templates/common/postcss.config.js +0 -5
- package/create/templates/common/splash-2732x2732.png +0 -0
- package/create/templates/common/tailwind/postcss.config.js +0 -5
- package/create/templates/common/tailwind/tailwind.config.js +0 -9
- package/create/templates/common/tailwind/tailwind.css +0 -3
- package/create/templates/common/webpack/build.js +0 -41
- package/create/templates/copy-assets.js +0 -158
- package/create/templates/core/babel.config.js +0 -11
- package/create/templates/core/copy-assets.js +0 -83
- package/create/templates/core/generate-home-page.js +0 -143
- package/create/templates/core/generate-root.js +0 -283
- package/create/templates/core/generate-routes.js +0 -155
- package/create/templates/core/generate-scripts.js +0 -94
- package/create/templates/core/pages/404.html +0 -20
- package/create/templates/core/pages/about.html +0 -26
- package/create/templates/core/pages/catalog.html +0 -40
- package/create/templates/core/pages/dynamic-route.html +0 -115
- package/create/templates/core/pages/form.html +0 -258
- package/create/templates/core/pages/left-page-1.html +0 -24
- package/create/templates/core/pages/left-page-2.html +0 -23
- package/create/templates/core/pages/product.html +0 -36
- package/create/templates/core/pages/request-and-load.html +0 -35
- package/create/templates/core/pages/settings.html +0 -252
- package/create/templates/create-folders.js +0 -30
- package/create/templates/dist/generate-styles.dev.js +0 -46
- package/create/templates/generate-config-xml.js +0 -18
- package/create/templates/generate-index.js +0 -49
- package/create/templates/generate-manifest.js +0 -49
- package/create/templates/generate-recoil.js +0 -56
- package/create/templates/generate-routes.js +0 -16
- package/create/templates/generate-scripts.js +0 -16
- package/create/templates/generate-service-worker.js +0 -126
- package/create/templates/generate-store.js +0 -88
- package/create/templates/generate-styles.js +0 -110
- package/create/templates/generate-webpack-config.js +0 -335
- package/create/templates/generate-zmp-custom.js +0 -81
- package/create/templates/react/babel.config.js +0 -12
- package/create/templates/react/components/app-items.jsx +0 -44
- package/create/templates/react/components/navbar-back.jsx +0 -25
- package/create/templates/react/components/user-card.jsx +0 -18
- package/create/templates/react/copy-assets.js +0 -85
- package/create/templates/react/dist/generate-scripts.dev.js +0 -23
- package/create/templates/react/generate-home-page.js +0 -111
- package/create/templates/react/generate-root.js +0 -84
- package/create/templates/react/generate-routes.js +0 -16
- package/create/templates/react/generate-scripts.js +0 -68
- package/create/templates/react/pages/404.js +0 -27
- package/create/templates/react/pages/about.js +0 -52
- package/create/templates/react/pages/catalog.js +0 -112
- package/create/templates/react/pages/dynamic-route.js +0 -80
- package/create/templates/react/pages/form.js +0 -152
- package/create/templates/react/pages/index copy.js +0 -17
- package/create/templates/react/pages/index.js +0 -17
- package/create/templates/react/pages/settings.js +0 -76
- package/create/templates/react/pages/user.js +0 -56
- package/create/templates/react/vite.config.js +0 -11
- package/create/templates/react-typescript/_tsconfig.json +0 -33
- package/create/templates/react-typescript/components/app-items.js +0 -53
- package/create/templates/react-typescript/components/index.js +0 -9
- package/create/templates/react-typescript/components/navbar-back.js +0 -40
- package/create/templates/react-typescript/components/user-card.js +0 -32
- package/create/templates/react-typescript/copy-assets.js +0 -94
- package/create/templates/react-typescript/dist/generate-scripts.dev.js +0 -23
- package/create/templates/react-typescript/generate-home-page.js +0 -113
- package/create/templates/react-typescript/generate-root.js +0 -81
- package/create/templates/react-typescript/generate-routes.js +0 -12
- package/create/templates/react-typescript/generate-scripts.js +0 -67
- package/create/templates/react-typescript/pages/404.js +0 -27
- package/create/templates/react-typescript/pages/about.js +0 -52
- package/create/templates/react-typescript/pages/catalog.js +0 -112
- package/create/templates/react-typescript/pages/dynamic-route.js +0 -80
- package/create/templates/react-typescript/pages/form.js +0 -152
- package/create/templates/react-typescript/pages/index.js +0 -17
- package/create/templates/react-typescript/pages/settings.js +0 -76
- package/create/templates/react-typescript/pages/user.js +0 -56
- package/create/templates/react-typescript/vite.config.js +0 -21
- package/create/templates/svelte/babel.config.js +0 -10
- package/create/templates/svelte/copy-assets.js +0 -47
- package/create/templates/svelte/generate-home-page.js +0 -158
- package/create/templates/svelte/generate-root.js +0 -235
- package/create/templates/svelte/generate-routes.js +0 -91
- package/create/templates/svelte/generate-scripts.js +0 -47
- package/create/templates/svelte/pages/404.svelte +0 -10
- package/create/templates/svelte/pages/about.svelte +0 -16
- package/create/templates/svelte/pages/catalog.svelte +0 -31
- package/create/templates/svelte/pages/dynamic-route.svelte +0 -34
- package/create/templates/svelte/pages/form.svelte +0 -175
- package/create/templates/svelte/pages/left-page-1.svelte +0 -13
- package/create/templates/svelte/pages/left-page-2.svelte +0 -12
- package/create/templates/svelte/pages/product.svelte +0 -21
- package/create/templates/svelte/pages/request-and-load.svelte +0 -21
- package/create/templates/svelte/pages/settings.svelte +0 -175
- package/create/templates/vue/babel.config.js +0 -10
- package/create/templates/vue/components/header.vue +0 -28
- package/create/templates/vue/components/sun-and-moon.vue +0 -34
- package/create/templates/vue/copy-assets.js +0 -67
- package/create/templates/vue/generate-home-page.js +0 -56
- package/create/templates/vue/generate-root.js +0 -50
- package/create/templates/vue/generate-routes.js +0 -7
- package/create/templates/vue/generate-scripts.js +0 -63
- package/create/templates/vue/global-components.d.ts +0 -121
- package/create/templates/vue/icons/moon.svg +0 -3
- package/create/templates/vue/icons/sun.svg +0 -3
- package/create/templates/vue/pages/404.vue +0 -12
- package/create/templates/vue/pages/about.vue +0 -15
- package/create/templates/vue/pages/catalog.vue +0 -39
- package/create/templates/vue/pages/dynamic-route.vue +0 -34
- package/create/templates/vue/pages/form.vue +0 -162
- package/create/templates/vue/pages/left-page-1.vue +0 -14
- package/create/templates/vue/pages/left-page-2.vue +0 -11
- package/create/templates/vue/pages/product.vue +0 -31
- package/create/templates/vue/pages/request-and-load.vue +0 -25
- package/create/templates/vue/pages/settings.vue +0 -18
- package/create/templates/vue/vite.config.js +0 -11
- package/create/templates/zaui/_tsconfig.json +0 -33
- package/create/templates/zaui/babel.config.js +0 -12
- package/create/templates/zaui/components/user-card.jsx +0 -16
- package/create/templates/zaui/copy-assets.js +0 -90
- package/create/templates/zaui/generate-home-page.js +0 -117
- package/create/templates/zaui/generate-root.js +0 -53
- package/create/templates/zaui/generate-routes.js +0 -10
- package/create/templates/zaui/generate-scripts.js +0 -39
- package/create/templates/zaui/generate-user-card.js +0 -55
- package/create/templates/zaui/pages/about.js +0 -129
- package/create/templates/zaui/pages/form.js +0 -123
- package/create/templates/zaui/pages/index.js +0 -9
- package/create/templates/zaui/pages/user.js +0 -109
- package/create/templates/zaui/vite.config.js +0 -11
- package/create/utils/colors.js +0 -94
- package/create/utils/dist/get-options.dev.js +0 -277
- package/create/utils/generate-gitignore.js +0 -43
- package/create/utils/generate-package-json.js +0 -132
- package/create/utils/generate-readme.js +0 -28
- package/create/utils/indent.js +0 -31
- package/create/utils/string.js +0 -13
- package/create/utils/styles-extension.js +0 -9
- package/create/utils/template-if.js +0 -9
- package/deploy/dist/index.dev.js +0 -227
- package/deploy/utils/dist/request-upload.dev.js +0 -62
- package/deploy/utils/dist/upload-app.dev.js +0 -113
- package/dist/bundle.js +0 -1
- package/dist/index.dev.js +0 -352
- package/jsconfig.json +0 -8
- package/login/dist/index.dev.js +0 -223
- package/login/utils/dist/zalo-login.dev.js +0 -41
- 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/start/generate-hr-config.js +0 -59
- 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,235 +0,0 @@
|
|
|
1
|
-
const indent = require('../../utils/indent');
|
|
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
|
-
`
|
|
12
|
-
<!-- Left panel with cover effect-->
|
|
13
|
-
<Panel left cover themeDark>
|
|
14
|
-
<View>
|
|
15
|
-
<Page>
|
|
16
|
-
<Navbar title="Left Panel"/>
|
|
17
|
-
<Block>Left panel content goes here</Block>
|
|
18
|
-
</Page>
|
|
19
|
-
</View>
|
|
20
|
-
</Panel>
|
|
21
|
-
`
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const leftPanelWithView = indent(
|
|
25
|
-
6,
|
|
26
|
-
`
|
|
27
|
-
<!-- Left panel with cover effect when hidden -->
|
|
28
|
-
<Panel left cover themeDark visibleBreakpoint={960}>
|
|
29
|
-
<View>
|
|
30
|
-
<Page>
|
|
31
|
-
<Navbar title="Left Panel"/>
|
|
32
|
-
<BlockTitle>Left View Navigation</BlockTitle>
|
|
33
|
-
<List>
|
|
34
|
-
<ListItem link="/left-page-1/" title="Left Page 1"/>
|
|
35
|
-
<ListItem link="/left-page-2/" title="Left Page 2"/>
|
|
36
|
-
</List>
|
|
37
|
-
<BlockTitle>Control Main View</BlockTitle>
|
|
38
|
-
<List>
|
|
39
|
-
<ListItem link="/about/" view=".view-main" panelClose title="About"/>
|
|
40
|
-
<ListItem link="/form/" view=".view-main" panelClose title="Form"/>
|
|
41
|
-
<ListItem link="#" view=".view-main" back panelClose title="Back in history"/>
|
|
42
|
-
</List>
|
|
43
|
-
</Page>
|
|
44
|
-
</View>
|
|
45
|
-
</Panel>
|
|
46
|
-
`
|
|
47
|
-
);
|
|
48
|
-
const leftPanel =
|
|
49
|
-
template === 'split-view' ? leftPanelWithView : leftPanelPlain;
|
|
50
|
-
const rightPanel = indent(
|
|
51
|
-
6,
|
|
52
|
-
`
|
|
53
|
-
<!-- Right panel with reveal effect-->
|
|
54
|
-
<Panel right reveal themeDark>
|
|
55
|
-
<View>
|
|
56
|
-
<Page>
|
|
57
|
-
<Navbar title="Right Panel"/>
|
|
58
|
-
<Block>Right panel content goes here</Block>
|
|
59
|
-
</Page>
|
|
60
|
-
</View>
|
|
61
|
-
</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
|
-
`
|
|
75
|
-
<!-- Your main view, should have "view-main" class -->
|
|
76
|
-
<View main class="safe-areas" url="/" />
|
|
77
|
-
`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
if (template === 'tabs') {
|
|
81
|
-
views = indent(
|
|
82
|
-
6,
|
|
83
|
-
`
|
|
84
|
-
<!-- Views/Tabs container -->
|
|
85
|
-
<Views tabs class="safe-areas">
|
|
86
|
-
<!-- Tabbar for switching views-tabs -->
|
|
87
|
-
<Toolbar tabbar labels bottom>
|
|
88
|
-
<Link tabLink="#view-home" tabLinkActive iconIos="zmp:house_fill" iconAurora="zmp:house_fill" iconMd="material:home" text="Home" />
|
|
89
|
-
<Link tabLink="#view-catalog" iconIos="zmp:square_list_fill" iconAurora="zmp:square_list_fill" iconMd="material:view_list" text="Catalog" />
|
|
90
|
-
<Link tabLink="#view-settings" iconIos="zmp:gear" iconAurora="zmp:gear" iconMd="material:settings" text="Settings" />
|
|
91
|
-
</Toolbar>
|
|
92
|
-
|
|
93
|
-
<!-- Your main view/tab, should have "view-main" class. It also has "tabActive" prop -->
|
|
94
|
-
<View id="view-home" main tab tabActive url="/" />
|
|
95
|
-
|
|
96
|
-
<!-- Catalog View -->
|
|
97
|
-
<View id="view-catalog" name="catalog" tab url="/catalog/" />
|
|
98
|
-
|
|
99
|
-
<!-- Settings View -->
|
|
100
|
-
<View id="view-settings" name="settings" tab url="/settings/" />
|
|
101
|
-
|
|
102
|
-
</Views>
|
|
103
|
-
`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return indent(
|
|
108
|
-
0,
|
|
109
|
-
`
|
|
110
|
-
${
|
|
111
|
-
template === 'blank'
|
|
112
|
-
? `
|
|
113
|
-
<App { ...zmpparams } ${theming.darkTheme ? 'themeDark' : ''}>
|
|
114
|
-
${views}
|
|
115
|
-
</App>
|
|
116
|
-
`.trim()
|
|
117
|
-
: `
|
|
118
|
-
<App { ...zmpparams } ${theming.darkTheme ? 'themeDark' : ''}>
|
|
119
|
-
${leftPanel}
|
|
120
|
-
${rightPanel}
|
|
121
|
-
${views}
|
|
122
|
-
|
|
123
|
-
<!-- Popup -->
|
|
124
|
-
<Popup id="my-popup">
|
|
125
|
-
<View>
|
|
126
|
-
<Page>
|
|
127
|
-
<Navbar title="Popup">
|
|
128
|
-
<NavRight>
|
|
129
|
-
<Link popupClose>Close</Link>
|
|
130
|
-
</NavRight>
|
|
131
|
-
</Navbar>
|
|
132
|
-
<Block>
|
|
133
|
-
<p>Popup content goes here.</p>
|
|
134
|
-
</Block>
|
|
135
|
-
</Page>
|
|
136
|
-
</View>
|
|
137
|
-
</Popup>
|
|
138
|
-
|
|
139
|
-
<LoginScreen id="my-login-screen">
|
|
140
|
-
<View>
|
|
141
|
-
<Page loginScreen>
|
|
142
|
-
<LoginScreenTitle>Login</LoginScreenTitle>
|
|
143
|
-
<List form>
|
|
144
|
-
<ListInput
|
|
145
|
-
type="text"
|
|
146
|
-
name="username"
|
|
147
|
-
placeholder="Your username"
|
|
148
|
-
bind:value={username}
|
|
149
|
-
/>
|
|
150
|
-
<ListInput
|
|
151
|
-
type="password"
|
|
152
|
-
name="password"
|
|
153
|
-
placeholder="Your password"
|
|
154
|
-
bind:value={password}
|
|
155
|
-
/>
|
|
156
|
-
</List>
|
|
157
|
-
<List>
|
|
158
|
-
<ListButton title="Sign In" onClick={() => alertLoginData()} />
|
|
159
|
-
</List>
|
|
160
|
-
<BlockFooter>
|
|
161
|
-
Some text about login information.<br />Click "Sign In" to close Login Screen
|
|
162
|
-
</BlockFooter>
|
|
163
|
-
</Page>
|
|
164
|
-
</View>
|
|
165
|
-
</LoginScreen>
|
|
166
|
-
</App>
|
|
167
|
-
`.trim()
|
|
168
|
-
}
|
|
169
|
-
<script>
|
|
170
|
-
import { onMount } from 'svelte';
|
|
171
|
-
${templateIf(
|
|
172
|
-
template === 'blank',
|
|
173
|
-
() => `
|
|
174
|
-
import {
|
|
175
|
-
zmp,
|
|
176
|
-
zmpready,
|
|
177
|
-
App,
|
|
178
|
-
View,
|
|
179
|
-
} from 'zmp-svelte';
|
|
180
|
-
`,
|
|
181
|
-
() => `
|
|
182
|
-
import {
|
|
183
|
-
zmp,
|
|
184
|
-
zmpready,
|
|
185
|
-
App,
|
|
186
|
-
Panel,
|
|
187
|
-
Views,
|
|
188
|
-
View,
|
|
189
|
-
Popup,
|
|
190
|
-
Page,
|
|
191
|
-
Navbar,
|
|
192
|
-
Toolbar,
|
|
193
|
-
NavRight,
|
|
194
|
-
Link,
|
|
195
|
-
Block,
|
|
196
|
-
BlockTitle,
|
|
197
|
-
LoginScreen,
|
|
198
|
-
LoginScreenTitle,
|
|
199
|
-
List,
|
|
200
|
-
ListItem,
|
|
201
|
-
ListInput,
|
|
202
|
-
ListButton,
|
|
203
|
-
BlockFooter
|
|
204
|
-
} from 'zmp-svelte';
|
|
205
|
-
`
|
|
206
|
-
)}
|
|
207
|
-
import store from '../store';
|
|
208
|
-
|
|
209
|
-
// ZMP Parameters
|
|
210
|
-
let zmpparams = {
|
|
211
|
-
${indent(8, appParameters(options)).trim()}
|
|
212
|
-
};
|
|
213
|
-
${templateIf(
|
|
214
|
-
template !== 'blank',
|
|
215
|
-
() => `
|
|
216
|
-
// Login screen demo data
|
|
217
|
-
let username = '';
|
|
218
|
-
let password = '';
|
|
219
|
-
|
|
220
|
-
function alertLoginData() {
|
|
221
|
-
zmp.dialog.alert('Username: ' + username + '<br>Password: ' + password, () => {
|
|
222
|
-
zmp.loginScreen.close();
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
`
|
|
226
|
-
)}
|
|
227
|
-
onMount(() => {
|
|
228
|
-
zmpready(() => {
|
|
229
|
-
// Call ZMP APIs here
|
|
230
|
-
});
|
|
231
|
-
})
|
|
232
|
-
</script>
|
|
233
|
-
`
|
|
234
|
-
).trim();
|
|
235
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
const templateIf = require('../../utils/template-if');
|
|
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, `
|
|
11
|
-
import HomePage from './pages/home.svelte';
|
|
12
|
-
|
|
13
|
-
var routes = [
|
|
14
|
-
{
|
|
15
|
-
path: '/',
|
|
16
|
-
component: HomePage,
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export default routes;
|
|
21
|
-
`);
|
|
22
|
-
}
|
|
23
|
-
// Webpack Routes
|
|
24
|
-
const routes = indent(0, `
|
|
25
|
-
import HomePage from './pages/home.svelte';
|
|
26
|
-
import AboutPage from './pages/about.svelte';
|
|
27
|
-
import FormPage from './pages/form.svelte';
|
|
28
|
-
${templateIf(template === 'tabs', () => `
|
|
29
|
-
import CatalogPage from './pages/catalog.svelte';
|
|
30
|
-
import ProductPage from './pages/product.svelte';
|
|
31
|
-
import SettingsPage from './pages/settings.svelte';
|
|
32
|
-
`)}
|
|
33
|
-
${templateIf(template === 'split-view', () => `
|
|
34
|
-
import LeftPage1 from './pages/left-page-1.svelte';
|
|
35
|
-
import LeftPage2 from './pages/left-page-2.svelte';
|
|
36
|
-
`)}
|
|
37
|
-
import DynamicRoutePage from './pages/dynamic-route.svelte';
|
|
38
|
-
import NotFoundPage from './pages/404.svelte';
|
|
39
|
-
|
|
40
|
-
var routes = [
|
|
41
|
-
{
|
|
42
|
-
path: '/',
|
|
43
|
-
component: HomePage,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
path: '/about/',
|
|
47
|
-
component: AboutPage,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
path: '/form/',
|
|
51
|
-
component: FormPage,
|
|
52
|
-
},
|
|
53
|
-
${templateIf(template === 'tabs', () => `
|
|
54
|
-
{
|
|
55
|
-
path: '/catalog/',
|
|
56
|
-
component: CatalogPage,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
path: '/product/:id/',
|
|
60
|
-
component: ProductPage,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
path: '/settings/',
|
|
64
|
-
component: SettingsPage,
|
|
65
|
-
},
|
|
66
|
-
`)}
|
|
67
|
-
${templateIf(template === 'split-view', () => `
|
|
68
|
-
{
|
|
69
|
-
path: '/left-page-1/',
|
|
70
|
-
component: LeftPage1,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
path: '/left-page-2/',
|
|
74
|
-
component: LeftPage2,
|
|
75
|
-
},
|
|
76
|
-
`)}
|
|
77
|
-
{
|
|
78
|
-
path: '/dynamic-route/blog/:blogId/post/:postId/',
|
|
79
|
-
component: DynamicRoutePage,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
path: '(.*)',
|
|
83
|
-
component: NotFoundPage,
|
|
84
|
-
},
|
|
85
|
-
];
|
|
86
|
-
|
|
87
|
-
export default routes;
|
|
88
|
-
`);
|
|
89
|
-
|
|
90
|
-
return routes;
|
|
91
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const templateIf = require('../../utils/template-if');
|
|
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, `
|
|
15
|
-
// Import ZMP
|
|
16
|
-
import ZMP from '${customBuild ? './zmp-custom.js' : 'zmp-framework/core/lite-bundle'}';
|
|
17
|
-
|
|
18
|
-
// Import ZMP-Svelte Plugin
|
|
19
|
-
import ZMPSvelte from 'zmp-svelte';
|
|
20
|
-
|
|
21
|
-
// Import ZMP Styles
|
|
22
|
-
${templateIf(customBuild, () => `
|
|
23
|
-
import '../css/zmp-custom.less';
|
|
24
|
-
`, () => `
|
|
25
|
-
import 'zmp-framework/zmp-bundle.min.css';
|
|
26
|
-
`)}
|
|
27
|
-
|
|
28
|
-
// Import Icons and App Custom Styles
|
|
29
|
-
${templateIf(theming.iconFonts, () => `
|
|
30
|
-
import '../css/icons.css';
|
|
31
|
-
`)}
|
|
32
|
-
import '../css/app.${stylesExtension(cssPreProcessor)}';
|
|
33
|
-
|
|
34
|
-
// Import App Component
|
|
35
|
-
import App from '../components/app.svelte';
|
|
36
|
-
|
|
37
|
-
// Init ZMP Svelte Plugin
|
|
38
|
-
ZMP.use(ZMPSvelte)
|
|
39
|
-
|
|
40
|
-
// Mount Svelte App
|
|
41
|
-
const app = new App({
|
|
42
|
-
target: document.getElementById('app'),
|
|
43
|
-
});
|
|
44
|
-
`);
|
|
45
|
-
|
|
46
|
-
return scripts.trim();
|
|
47
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<Page>
|
|
2
|
-
<Navbar title="About" backLink="Back" />
|
|
3
|
-
<BlockTitle>About My App</BlockTitle>
|
|
4
|
-
<Block strong>
|
|
5
|
-
<p>Fugiat perspiciatis excepturi, soluta quod non ullam deleniti. Nobis sint nemo consequuntur, fugiat. Eius perferendis animi autem incidunt vel quod tenetur nostrum, voluptate omnis quasi quidem illum consequuntur, a, quisquam.</p>
|
|
6
|
-
<p>Laudantium neque magnam vitae nemo quam commodi, in cum dolore obcaecati laborum, excepturi harum, optio qui, consequuntur? Obcaecati dolor sequi nesciunt culpa quia perspiciatis, reiciendis ex debitis, ut tenetur alias.</p>
|
|
7
|
-
</Block>
|
|
8
|
-
<Block strong>
|
|
9
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni molestiae laudantium dignissimos est nobis delectus nemo ea alias voluptatum architecto, amet similique, saepe iste consectetur in repellat ut minus quibusdam!</p>
|
|
10
|
-
<p>Molestias et distinctio porro nesciunt ratione similique, magni doloribus, rerum nobis, aliquam quae reiciendis quasi modi. Nam a recusandae, fugiat in ea voluptates fuga eius, velit corrupti reprehenderit dignissimos consequatur!</p>
|
|
11
|
-
<p>Blanditiis, cumque quo adipisci. Molestiae, dolores dolorum quos doloremque ipsa ullam eligendi commodi deserunt doloribus inventore magni? Ea mollitia veniam nostrum nihil, iusto doloribus a at! Ea molestiae ullam delectus!</p>
|
|
12
|
-
</Block>
|
|
13
|
-
</Page>
|
|
14
|
-
<script>
|
|
15
|
-
import { Page, Navbar, Block, BlockTitle } from 'zmp-svelte';
|
|
16
|
-
</script>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<Page name="catalog">
|
|
2
|
-
<Navbar title="Catalog" />
|
|
3
|
-
<List>
|
|
4
|
-
{#each products as product, index (product.id)}
|
|
5
|
-
<ListItem
|
|
6
|
-
title={product.title}
|
|
7
|
-
link={`/product/${product.id}/`}
|
|
8
|
-
/>
|
|
9
|
-
{/each}
|
|
10
|
-
</List>
|
|
11
|
-
{#if products.length === 3}
|
|
12
|
-
<Block>
|
|
13
|
-
<Button fill onClick={addProduct}>Add Product</Button>
|
|
14
|
-
</Block>
|
|
15
|
-
{/if}
|
|
16
|
-
</Page>
|
|
17
|
-
<script>
|
|
18
|
-
import { Page, Navbar, List, ListItem, Block, Button, useStore } from 'zmp-svelte';
|
|
19
|
-
import store from '../store';
|
|
20
|
-
|
|
21
|
-
let products = useStore('products', (value) => (products = value));
|
|
22
|
-
|
|
23
|
-
const addProduct = () => {
|
|
24
|
-
store.dispatch('addProduct', {
|
|
25
|
-
id: '4',
|
|
26
|
-
title: 'Apple iPhone 12',
|
|
27
|
-
description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi tempora similique reiciendis, error nesciunt vero, blanditiis pariatur dolor, minima sed sapiente rerum, dolorem corrupti hic modi praesentium unde saepe perspiciatis.'
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
</script>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<Page>
|
|
2
|
-
<Navbar title="Dynamic Route" backLink="Back" />
|
|
3
|
-
<Block strong>
|
|
4
|
-
<ul>
|
|
5
|
-
<li><b>Url:</b> {zmproute.url}</li>
|
|
6
|
-
<li><b>Path:</b> {zmproute.path}</li>
|
|
7
|
-
<li><b>Hash:</b> {zmproute.hash}</li>
|
|
8
|
-
<li><b>Params:</b>
|
|
9
|
-
<ul>
|
|
10
|
-
{#each Object.keys(zmproute.params) as key}
|
|
11
|
-
<li><b>{key}:</b> {zmproute.params[key]}</li>
|
|
12
|
-
{/each}
|
|
13
|
-
</ul>
|
|
14
|
-
</li>
|
|
15
|
-
<li><b>Query:</b>
|
|
16
|
-
<ul>
|
|
17
|
-
{#each Object.keys(zmproute.query) as key}
|
|
18
|
-
<li><b>{key}:</b> {zmproute.query[key]}</li>
|
|
19
|
-
{/each}
|
|
20
|
-
</ul>
|
|
21
|
-
</li>
|
|
22
|
-
<li><b>Route:</b> {zmproute.route.path}</li>
|
|
23
|
-
</ul>
|
|
24
|
-
</Block>
|
|
25
|
-
<Block strong>
|
|
26
|
-
<Link onClick={() => zmprouter.back()}>Go back via Router API</Link>
|
|
27
|
-
</Block>
|
|
28
|
-
</Page>
|
|
29
|
-
<script>
|
|
30
|
-
import { Page, Navbar, Block, Link } from 'zmp-svelte';
|
|
31
|
-
|
|
32
|
-
export let zmproute;
|
|
33
|
-
export let zmprouter;
|
|
34
|
-
</script>
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
<Page name="form">
|
|
2
|
-
<Navbar title="Form" backLink="Back"></Navbar>
|
|
3
|
-
|
|
4
|
-
<BlockTitle>Form Example</BlockTitle>
|
|
5
|
-
<List noHairlinesMd>
|
|
6
|
-
<ListInput
|
|
7
|
-
label="Name"
|
|
8
|
-
type="text"
|
|
9
|
-
placeholder="Your name"
|
|
10
|
-
></ListInput>
|
|
11
|
-
|
|
12
|
-
<ListInput
|
|
13
|
-
label="E-mail"
|
|
14
|
-
type="email"
|
|
15
|
-
placeholder="E-mail"
|
|
16
|
-
></ListInput>
|
|
17
|
-
|
|
18
|
-
<ListInput
|
|
19
|
-
label="URL"
|
|
20
|
-
type="url"
|
|
21
|
-
placeholder="URL"
|
|
22
|
-
></ListInput>
|
|
23
|
-
|
|
24
|
-
<ListInput
|
|
25
|
-
label="Password"
|
|
26
|
-
type="password"
|
|
27
|
-
placeholder="Password"
|
|
28
|
-
></ListInput>
|
|
29
|
-
|
|
30
|
-
<ListInput
|
|
31
|
-
label="Phone"
|
|
32
|
-
type="tel"
|
|
33
|
-
placeholder="Phone"
|
|
34
|
-
></ListInput>
|
|
35
|
-
|
|
36
|
-
<ListInput
|
|
37
|
-
label="Gender"
|
|
38
|
-
type="select"
|
|
39
|
-
>
|
|
40
|
-
<option>Male</option>
|
|
41
|
-
<option>Female</option>
|
|
42
|
-
</ListInput>
|
|
43
|
-
|
|
44
|
-
<ListInput
|
|
45
|
-
label="Birth date"
|
|
46
|
-
type="date"
|
|
47
|
-
placeholder="Birth day"
|
|
48
|
-
value="2014-04-30"
|
|
49
|
-
></ListInput>
|
|
50
|
-
|
|
51
|
-
<ListItem
|
|
52
|
-
title="Toggle"
|
|
53
|
-
>
|
|
54
|
-
<span slot="after">
|
|
55
|
-
<Toggle />
|
|
56
|
-
</span>
|
|
57
|
-
</ListItem>
|
|
58
|
-
|
|
59
|
-
<ListInput
|
|
60
|
-
label="Range"
|
|
61
|
-
input={false}
|
|
62
|
-
>
|
|
63
|
-
<span slot="input">
|
|
64
|
-
<Range value={50} min={0} max={100} step={1} />
|
|
65
|
-
</span>
|
|
66
|
-
</ListInput>
|
|
67
|
-
|
|
68
|
-
<ListInput
|
|
69
|
-
type="textarea"
|
|
70
|
-
label="Textarea"
|
|
71
|
-
placeholder="Bio"
|
|
72
|
-
></ListInput>
|
|
73
|
-
<ListInput
|
|
74
|
-
type="textarea"
|
|
75
|
-
label="Resizable"
|
|
76
|
-
placeholder="Bio"
|
|
77
|
-
resizable
|
|
78
|
-
></ListInput>
|
|
79
|
-
</List>
|
|
80
|
-
|
|
81
|
-
<BlockTitle>Buttons</BlockTitle>
|
|
82
|
-
<Block strong>
|
|
83
|
-
<Row tag="p">
|
|
84
|
-
<Button class="col">Button</Button>
|
|
85
|
-
<Button class="col" fill>Fill</Button>
|
|
86
|
-
</Row>
|
|
87
|
-
<Row tag="p">
|
|
88
|
-
<Button class="col" raised>Raised</Button>
|
|
89
|
-
<Button class="col" raised fill>Raised Fill</Button>
|
|
90
|
-
</Row>
|
|
91
|
-
<Row tag="p">
|
|
92
|
-
<Button class="col" round>Round</Button>
|
|
93
|
-
<Button class="col" round fill>Round Fill</Button>
|
|
94
|
-
</Row>
|
|
95
|
-
<Row tag="p">
|
|
96
|
-
<Button class="col" outline>Outline</Button>
|
|
97
|
-
<Button class="col" round outline>Outline Round</Button>
|
|
98
|
-
</Row>
|
|
99
|
-
<Row tag="p">
|
|
100
|
-
<Button class="col" small outline>Small</Button>
|
|
101
|
-
<Button class="col" small round outline>Small Round</Button>
|
|
102
|
-
</Row>
|
|
103
|
-
<Row tag="p">
|
|
104
|
-
<Button class="col" small fill>Small</Button>
|
|
105
|
-
<Button class="col" small round fill>Small Round</Button>
|
|
106
|
-
</Row>
|
|
107
|
-
<Row tag="p">
|
|
108
|
-
<Button class="col" large raised>Large</Button>
|
|
109
|
-
<Button class="col" large fill raised>Large Fill</Button>
|
|
110
|
-
</Row>
|
|
111
|
-
<Row tag="p">
|
|
112
|
-
<Button class="col" large fill raised color="red">Large Red</Button>
|
|
113
|
-
<Button class="col" large fill raised color="green">Large Green</Button>
|
|
114
|
-
</Row>
|
|
115
|
-
</Block>
|
|
116
|
-
|
|
117
|
-
<BlockTitle>Checkbox group</BlockTitle>
|
|
118
|
-
<List>
|
|
119
|
-
<ListItem
|
|
120
|
-
checkbox
|
|
121
|
-
name="my-checkbox"
|
|
122
|
-
value="Books"
|
|
123
|
-
title="Books"
|
|
124
|
-
></ListItem>
|
|
125
|
-
<ListItem
|
|
126
|
-
checkbox
|
|
127
|
-
name="my-checkbox"
|
|
128
|
-
value="Movies"
|
|
129
|
-
title="Movies"
|
|
130
|
-
></ListItem>
|
|
131
|
-
<ListItem
|
|
132
|
-
checkbox
|
|
133
|
-
name="my-checkbox"
|
|
134
|
-
value="Food"
|
|
135
|
-
title="Food"
|
|
136
|
-
></ListItem>
|
|
137
|
-
</List>
|
|
138
|
-
|
|
139
|
-
<BlockTitle>Radio buttons group</BlockTitle>
|
|
140
|
-
<List>
|
|
141
|
-
<ListItem
|
|
142
|
-
radio
|
|
143
|
-
name="radio"
|
|
144
|
-
value="Books"
|
|
145
|
-
title="Books"
|
|
146
|
-
></ListItem>
|
|
147
|
-
<ListItem
|
|
148
|
-
radio
|
|
149
|
-
name="radio"
|
|
150
|
-
value="Movies"
|
|
151
|
-
title="Movies"
|
|
152
|
-
></ListItem>
|
|
153
|
-
<ListItem
|
|
154
|
-
radio
|
|
155
|
-
name="radio"
|
|
156
|
-
value="Food"
|
|
157
|
-
title="Food"
|
|
158
|
-
></ListItem>
|
|
159
|
-
</List>
|
|
160
|
-
</Page>
|
|
161
|
-
<script>
|
|
162
|
-
import {
|
|
163
|
-
Page,
|
|
164
|
-
Navbar,
|
|
165
|
-
List,
|
|
166
|
-
ListInput,
|
|
167
|
-
ListItem,
|
|
168
|
-
Toggle,
|
|
169
|
-
BlockTitle,
|
|
170
|
-
Row,
|
|
171
|
-
Button,
|
|
172
|
-
Range,
|
|
173
|
-
Block
|
|
174
|
-
} from 'zmp-svelte';
|
|
175
|
-
</script>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<Page>
|
|
2
|
-
<Navbar title="Left Page 1" backLink="Back" />
|
|
3
|
-
<Block strong>
|
|
4
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit deserunt vel accusamus voluptatem neque! Laborum, et facilis at. Est dolorem, reprehenderit, sed repellendus at cum incidunt labore vel perferendis excepturi?</p>
|
|
5
|
-
<p>Tempore accusantium quaerat officiis dolores ullam, perferendis labore assumenda. A sint quo necessitatibus temporibus ipsam adipisci et quos aliquid officiis, facilis nulla ut aperiam assumenda magnam blanditiis exercitationem facere non!</p>
|
|
6
|
-
<p>Omnis accusamus harum, vero dolores itaque, asperiores laudantium eligendi ipsa, labore dignissimos unde temporibus eius assumenda, obcaecati fuga et. Et provident at consectetur vel temporibus ea nam, veritatis excepturi obcaecati.</p>
|
|
7
|
-
<p>Aspernatur dolorum nostrum est sapiente deleniti in. Placeat itaque expedita dignissimos, suscipit tenetur necessitatibus sunt excepturi quisquam, doloremque repudiandae mollitia in. Nesciunt quo vel, dolorum magni nihil officia reprehenderit libero.</p>
|
|
8
|
-
<p>Fugit nesciunt nobis at doloribus labore, voluptatem quis, distinctio, saepe illo adipisci qui molestias fugiat ut! Quasi animi possimus temporibus repudiandae quam aspernatur, recusandae libero, reiciendis distinctio cupiditate nesciunt a.</p>
|
|
9
|
-
</Block>
|
|
10
|
-
</Page>
|
|
11
|
-
<script>
|
|
12
|
-
import { Page, Navbar, Block } from 'zmp-svelte';
|
|
13
|
-
</script>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<Page>
|
|
2
|
-
<Navbar title="Left Page 2" backLink="Back" />
|
|
3
|
-
<Block strong>
|
|
4
|
-
<p>Maxime tempore, repellendus? Sequi saepe provident quas, neque assumenda dicta odit eaque nesciunt facere mollitia totam voluptate aspernatur vel corporis repudiandae commodi ad cumque repellendus. Saepe officia iure repellat repellendus.</p>
|
|
5
|
-
<p>Ea maiores accusantium non fuga dicta, vero minus veniam! Ipsum eveniet vero voluptate veritatis aspernatur hic dicta adipisci, debitis. Sint quam aperiam repellat quis perspiciatis accusantium ipsum nulla soluta temporibus.</p>
|
|
6
|
-
<p>Necessitatibus ipsum culpa doloremque, nostrum atque totam minima itaque! Blanditiis nobis nam repudiandae, ut nostrum voluptate accusantium atque, veniam libero quaerat corporis laborum earum rem nihil unde. Vitae cum, aliquam?</p>
|
|
7
|
-
<p>Debitis aliquid nemo maxime recusandae, mollitia sed error vero. Atque molestiae rem necessitatibus nam voluptas quaerat, reiciendis, excepturi quis facilis, quod cupiditate vitae voluptate repudiandae! Unde impedit aut id ut?</p>
|
|
8
|
-
</Block>
|
|
9
|
-
</Page>
|
|
10
|
-
<script>
|
|
11
|
-
import { Page, Navbar, Block } from 'zmp-svelte';
|
|
12
|
-
</script>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<Page name="product">
|
|
2
|
-
<Navbar title={currentProduct.title} backLink="Back" />
|
|
3
|
-
<BlockTitle>About {currentProduct.title}</BlockTitle>
|
|
4
|
-
<Block strong>
|
|
5
|
-
{currentProduct.description}
|
|
6
|
-
</Block>
|
|
7
|
-
</Page>
|
|
8
|
-
<script>
|
|
9
|
-
import { Page, Navbar, BlockTitle, Block, useStore } from 'zmp-svelte';
|
|
10
|
-
|
|
11
|
-
export let zmproute;
|
|
12
|
-
|
|
13
|
-
const products = useStore('products');
|
|
14
|
-
const productId = zmproute.params.id;
|
|
15
|
-
let currentProduct;
|
|
16
|
-
products.forEach(function (product) {
|
|
17
|
-
if (product.id === productId) {
|
|
18
|
-
currentProduct = product;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
</script>
|